angular/angular-cli

`npm start` does not work when there is a library and `*` path mapping to resolve packages from root `node_modules`

Closed this issue · 2 comments

Bug Report or Feature Request (mark with an x)

- [x ] bug report -> please search issues before submitting
- [ ] feature request

Area

- [x ] devkit
- [ ] schematics

Versions

node v8.11.1
npm 5.6.0
Windows 10

Repro steps

  1. create a new app with angular cli
  2. add a library
  3. add extra path mapping to tsconfig.json:
"*": [
     "node_modules/*"
]
  1. run npm start and notice the error

The log given by the failure

ERROR in ./src/app/app.module.ts
Module not found: Error: Can't resolve 'ngx-test' in 'C:\Github\ngx-library-npm-link\src\app'
ℹ 「wdm」: Failed to compile.

Desired functionality

npm start works. Also note that building directly with ngc it works correctly.

There can be other angular libraries that need to be npm linked during development because they are not in the same repo. In that case, the common dependencies (@angular, @ngrx etc...) need to be resolved from the root node_modules folder to avoid bundling and resolving the dependencies from different locations.

Mention any other details that might be useful

Library with minimal reproduction:
https://github.com/peterbakonyi05/ngx-library-npm-link

Hi, @Brocco this issue is not related to ng-packagr but rather ngtools/webpack check #11304

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.