Closed as not planned
Description
Which @angular/* package(s) are the source of the bug?
router
Is this a regression?
No
Description
Repro:
- git clone a primeng library
- npm run build:lib
- cd myproject
- npm i ../../primeng/dist
- import MenubarModule
- ng build
Observe: modules cannot be resolved
- Try workaround by adding:
"paths": {
"primeng/*": ["../node_modules/primeng/*/public_api"]
},
- ng build succeeds
- Open application, observe NG0203
main.ts:27 ERROR Error: NG0203: inject() must be called from an injection context such as a constructor, a factory function, a field initializer, or a function used with `runInInjectionContext`. Find more at https://angular.io/errors/NG0203
- spend days debugging the issue
- solved by adding
preserveSymlinks: true
.
Please provide a link to a minimal reproduction of the bug
No response
Please provide the exception or error you saw
main.ts:27 ERROR Error: NG0203: inject() must be called from an injection context such as a constructor, a factory function, a field initializer, or a function used with `runInInjectionContext`. Find more at https://angular.io/errors/NG0203
Please provide the environment you discovered this bug in (run ng version
)
Angular CLI: 17.3.6
Node: 20.12.2
Package Manager: npm 10.5.0
OS: linux x64
Angular:
...
Package Version
------------------------------------------------------
@angular-devkit/architect 0.1703.6 (cli-only)
@angular-devkit/core 17.3.6 (cli-only)
@angular-devkit/schematics 17.3.6 (cli-only)
@schematics/angular 17.3.6 (cli-only)
Anything else?
preserveSymlinks
is not well documented (even after the solution I have no idea what it actually preserves), and the error message anything but points to the missing configuration. A more helpful error message would be great!
Metadata
Metadata
Assignees
Labels
No labels