Excluded folder is not being taking into account by tsconfig.json

I currently am facing this issue:

When creating an Angular workspace to create a reusable library the folder structure looks like this:

-- my-workspace
  -- projects
    -- my-library
    -- my-library-test-app

In the root tsconfig these paths will then be set

"paths": {
"my-library": [
"dist/my-library"
],
"my-library/*": [
"dist/my-library/*"
]
}


So this should give me the ability to do a nice import in my-library-test-app like this:

import { MyLibraryModule } from 'my-library';

Sadly this does not work. The reason for this is that the generate dist folder when I build the library is by default excluded.

When I remove the exclusion from the folder I can do an import ... but still it is the wrong one. Now IntelliJ will import like this:

import { MyLibraryModule } from 'my-library/lib/my-library.module.ts';

Which is of course not what I want, is there a way to fix this behaviour?

Thank you!

0
1 comment

Please follow https://youtrack.jetbrains.com/issue/WEB-39705 for updates

 

Note that auto-importing from files that are not indexed (excluded) had never been supported and will not likely be supported in the future, so you still have to un-exclude the folder to get imports working

0

Please sign in to leave a comment.