`UNRESOLVED_IMPORT` warning when importing libs from the same Nx workspace
See original GitHub issueI have a Nx workspace with 1 app and 6 libs (4 of which were generated using @nxext/stencil
):
- MyApp
- MainLib (stencil)
- LibA (stencil)
- LibB (stencil)
- LibC (stencil)
- Utils
- Types
MainLib is dependent on LibA and LibB.
When building MainLib I get this error for both LibA and LibB:
Bundling Warning UNRESOLVED_IMPORT
'@bv0012/lib-a' is imported by
../../../libs/main-lib/src/theme/component-map.ts, but could
not be resolved – treating it as an external dependency
There are no inline errors in component-map.ts
and my tsconfig.json
paths
property looks like this:
"paths": {
"@bv0012/main-lib": ["libs/main-lib/src/components.d.ts"],
"@bv0012/main-lib/*": ["libs/main-lib/src/*"],
"@bv0012/main-lib/loader": ["dist/libs/main-lib/loader"],
"@bv0012/main-lib/react": [
"dist/libs/generated/main-lib/react/src/components.ts"
],
"@bv0012/types": ["libs/types/src/index.d.ts"],
"@bv0012/utils": ["libs/utils/src/index.ts"],
"@bv0012/lib-a": ["dist/libs/lib-a"],
"@bv0012/lib-b": ["dist/libs/lib-b"],
"@bv0012/lib-c": ["dist/libs/lib-c"]
}
I’m pointing the lib paths to dist/
because they’re publishable.
I feel like this is a node-resolve
issue but I haven’t had any success debugging it so far.
Issue Analytics
- State:
- Created 3 years ago
- Comments:14 (13 by maintainers)
Top Results From Across the Web
python - Pylint "unresolved import" error in Visual Studio Code
The accepted answer won't fix the error when importing own modules. Use the following setting in your workspace settings ...
Read more >Applications and Libraries | Nx
A typical Nx workspace is structured into "apps" and "libs". This distinction allows us to have a more modular architecture by following a...
Read more >nrwl-nx/community - Gitter
I generated a node lib, I setup a entry in my workspace.json which copies json files to dist/assets/locale, in the node lib I...
Read more >no-restricted-imports - ESLint - Pluggable JavaScript Linter
Imports are an ES6/ES2015 standard for making the functionality of other modules available in your current module. In CommonJS this is implemented through ......
Read more >Create Your First Custom Angular CLI Schematic with Nx - Auth0
Learn how to create applications, libraries, and custom workspace CLI Angular schematics with enterprise Angular tool Nx.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@luchsamapparat thanks for your help.
Sorry for the late response, I’m at holidays right now. I’ll take a look at soon as I can
Okay, now I’m back and looked into this. I’ll do some experiments as well. The ugly/fastes solution could be using rollup again to bundle the libs. The @nrwl/web plugin does this, cause you can request the dependency tree und bundle up then. I’ll try some more with the stencil compiler but maybe that’s an workaround