-
Notifications
You must be signed in to change notification settings - Fork 11.9k
Description
🐞 Bug report
- new
- build
- serve
- test
- e2e
- generate
- add
- update
- lint
- extract-i18n
- run
- config
- help
- version
- doc
Is this a regression?
Just upgraded from Angular 11, so it was a definitely regression for me, but probably mostly due to webpack 5. I'm not sure about Angular 12 since I skipped that one.
Description
When creating an npm library and Angular app in different workspaces, ng serve used to listen for changes to node_modules, and would recompile if any files changed. As we made changes in the library locally, ng serve would pick them up, recompile, and hot reload the changes. It made development of libraries quite easy for local development, because you didn't have to publish to a local npm each time you made changes, install, and recompile. Now, since the introduction of webpack 5, this functionality is broken. Even when using the 2nd option suggested by the team here, ng serve doesn't detect a new change and recompile. (Option 1 isn't an option for me without a major overhaul of all our build pipelines, so I would like to avoid this if possible).
🔬 Minimal Reproduction
- Clone the following 2 repositories into a directory where they are siblings, and not in the same workspace:
1a. https://github.com/mikerentmeister/ngx-shared-lib
1b. https://github.com/mikerentmeister/test-app
1c.
- Open the ngx-shared-lib project, and run "yarn watch"
- Open the test-app project and run "yarn start"
- Make a change to the html, css, or typescript. Notice that the library will recompile, but no changes will be detected in the app using ng serve.
Quick note: generally I wouldn't have the file path in package.json, this was just for demo purposes. Generally the package.json would just have a reference to the @latest for my library, but would expect the tsconfig.compilerOptions.paths to be the source of truth.
🌍 Your Environment
_ _ ____ _ ___
/ \ _ __ __ _ _ _| | __ _ _ __ / ___| | |_ _|
/ △ \ | '_ \ / _` | | | | |/ _` | '__| | | | | | |
/ ___ \| | | | (_| | |_| | | (_| | | | |___| |___ | |
/_/ \_\_| |_|\__, |\__,_|_|\__,_|_| \____|_____|___|
|___/
Angular CLI: 13.0.1
Node: 16.13.0
Package Manager: yarn 1.22.15
OS: win32 x64
Angular: 13.0.0
... animations, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router
Package Version
---------------------------------------------------------
@angular-devkit/architect 0.1300.1
@angular-devkit/build-angular 13.0.1
@angular-devkit/core 13.0.1
@angular-devkit/schematics 13.0.1
@angular/cli 13.0.1
@schematics/angular 13.0.1
ng-packagr 13.0.3
rxjs 7.4.0
typescript 4.4.4
Anything else relevant?
If there is another way of developing a library in a different workspace, and using it locally, I'm all ears. This is a big hit to our Angular development though, because our production library is something that's worked on daily. If we have to stop, recompile, publish npm locally every time we make a change, it will prevent us from upgrading past Angular 11.