-
Notifications
You must be signed in to change notification settings - Fork 12k
Scoped library paths cannot be resolved #10620
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Same issue happening with me. Perhaps there's something in the configuration files that is needed to be changed manually for this to work? |
Same to load feature module with lazy loading
ERROR in Could not resolve module app/user/user.module relative to /C/dsv/client/pwa-ng/src/app/app.routing.ts |
Ah I was about to open an issue about this! Repro: git clone https://github.com/ngx-translate/core/tree/monorepo
npm i
ng build @ngx-translate/core
ng build @ngx-translate/http-loader Error log: ng build @ngx-translate/http-loader
Building Angular Package
Building entry point '@ngx-translate/http-loader'
Rendering Stylesheets
Rendering Templates
Compiling TypeScript sources through ngc
BUILD ERROR
projects/ngx-translate/http-loader/src/lib/http-loader.ts(2,31): error TS2307: Cannot find module '@ngx-translate/core'.
Error: projects/ngx-translate/http-loader/src/lib/http-loader.ts(2,31): error TS2307: Cannot find module '@ngx-translate/core'.
at Object.<anonymous> (C:\www\ngx-translate-monorepo\node_modules\ng-packagr\lib\ngc\compile-source-files.js:61:68)
at Generator.next (<anonymous>)
at C:\www\ngx-translate-monorepo\node_modules\ng-packagr\lib\ngc\compile-source-files.js:7:71
at new Promise (<anonymous>)
at __awaiter (C:\www\ngx-translate-monorepo\node_modules\ng-packagr\lib\ngc\compile-source-files.js:3:12)
at Object.compileSourceFiles (C:\www\ngx-translate-monorepo\node_modules\ng-packagr\lib\ngc\compile-source-files.js:19:12)
at Object.<anonymous> (C:\www\ngx-translate-monorepo\node_modules\ng-packagr\lib\ng-v5\entry-point\ts\compile-ngc.transform.js:42:34)
at Generator.next (<anonymous>)
at C:\www\ngx-translate-monorepo\node_modules\ng-packagr\lib\ng-v5\entry-point\ts\compile-ngc.transform.js:7:71
at new Promise (<anonymous>)
projects/ngx-translate/http-loader/src/lib/http-loader.ts(2,31): error TS2307: Cannot find module '@ngx-translate/core'.
Error: projects/ngx-translate/http-loader/src/lib/http-loader.ts(2,31): error TS2307: Cannot find module '@ngx-translate/core'.
at Object.<anonymous> (C:\www\ngx-translate-monorepo\node_modules\ng-packagr\lib\ngc\compile-source-files.js:61:68)
at Generator.next (<anonymous>)
at C:\www\ngx-translate-monorepo\node_modules\ng-packagr\lib\ngc\compile-source-files.js:7:71
at new Promise (<anonymous>)
at __awaiter (C:\www\ngx-translate-monorepo\node_modules\ng-packagr\lib\ngc\compile-source-files.js:3:12)
at Object.compileSourceFiles (C:\www\ngx-translate-monorepo\node_modules\ng-packagr\lib\ngc\compile-source-files.js:19:12)
at Object.<anonymous> (C:\www\ngx-translate-monorepo\node_modules\ng-packagr\lib\ng-v5\entry-point\ts\compile-ngc.transform.js:42:34)
at Generator.next (<anonymous>)
at C:\www\ngx-translate-monorepo\node_modules\ng-packagr\lib\ng-v5\entry-point\ts\compile-ngc.transform.js:7:71
at new Promise (<anonymous>) |
Temporary fix: use npm link ng build @ngx-translate/core
npm link ./dist/@ngx-translate/core
ng build @ngx-translate/http-loader |
I'm not sure what's going wrong here but you really shouldn't use |
I have implemented a similar workaround for my project:
and a postinstall script: All lib-projects had different 'dest' properties defined for production and non-production build ( see ng-package.json ), so this cannot work with static path definitions |
One sleepless night passed ...))) Thanks! |
Heya, I think the problems described in this issue are partially the same as #10615. angular/devkit#895 (using the right paths for scoped libs) together with ng-packagr/ng-packagr#862 (not overriding baseUrl in ng-package) should fix it. |
Not sure that issue's resolved 🤷♂️ I've been upgrading to the following:
and I get the error:
I can see that the dist folder contains |
I'm on version 6.2.2 (which I believe is well after the fix was merged in) and am seeing exactly the same issue as @maxime1992
|
I'm having the same issue as @maxime1992 and @rupertgcox and wonder if this has been solved or if there exists an solution? |
Is that issue similar ? |
So I'm not sure whether it's the same thing or not but I moved away from using libraries within the dist folder and instead pick up from the source directly.
became
When navigation with the IDE inside the code it's also giving me better access to the source instead of pointing to the dist folder 👍 |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
See also #10172
The generated path aliases seem not right.
Versions
Repro steps
Now try to import
BarModule
into the app.Observed behavior
The libraries are compiled correctly but the resulting directory structure in
dist
is not reflected by thepaths
definitions intsconfig.json
:BarModule
cannot be imported.Desired behavior
Add scopes to the
paths
definitions.Mention any other details that might be useful (optional)
The text was updated successfully, but these errors were encountered: