Skip to content

Lazy loading modules from Angular library does not work correctly #19370

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

Closed
2 of 15 tasks
jonathanlie opened this issue Nov 13, 2020 · 4 comments
Closed
2 of 15 tasks

Lazy loading modules from Angular library does not work correctly #19370

jonathanlie opened this issue Nov 13, 2020 · 4 comments

Comments

@jonathanlie
Copy link

🐞 Bug report

Command (mark with an x)

  • new
  • build
  • serve
  • test
  • e2e
  • generate
  • add
  • update
  • lint
  • extract-i18n
  • run
  • config
  • help
  • version
  • doc

Is this a regression?

Before Ivy (v8), the components are included in the lazy loaded chunks.

Description

Lazy loading does not work with feature modules exported from the same library project. Any additions to the feature module result in increase in main.js bundle size, instead of the lazy loaded feature module.

🔬 Minimal Reproduction

Clone this repo: https://github.com/jonathanlie/repro-lazy-loading-issue

  1. npm install
  2. Run ng build some-lib --watch on a tab
  3. Run ng serve some-app on a separate tab after
  4. Verify app is working on localhost:4200
  5. Remove / add content to listing.component.scss in projects/some-lib/src/lib/lazy/components/listing/listing.component.scss, and what happens is that the main.js bundle size is the one reduced instead.
Build at: 2020-11-13T06:22:30.373Z - Hash: c12a866456896e242a74 - Time: 2012ms

✔ Compiled successfully.
✔ Browser application bundle generation complete.

Initial Chunk Files | Names |     Size
main.js             | main  | 16.81 kB

5 unchanged chunks

Build at: 2020-11-13T06:22:39.887Z - Hash: a02cce926638fc0cef6b - Time: 151ms

✔ Compiled successfully.
✔ Browser application bundle generation complete.

Initial Chunk Files | Names |     Size
main.js             | main  | 17.19 kB

🌍 Your Environment


Angular CLI: 11.0.1
Node: 12.14.0
OS: darwin x64

Angular: 11.0.0
... animations, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router
Ivy Workspace: Yes

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1100.1
@angular-devkit/build-angular   0.1100.1
@angular-devkit/core            11.0.1
@angular-devkit/schematics      11.0.1
@angular/cli                    11.0.1
@schematics/angular             11.0.1
@schematics/update              0.1100.1
ng-packagr                      11.0.2
rxjs                            6.6.3
typescript                      4.0.5

@alan-agius4
Copy link
Collaborator

Same root cause of #13635

@jonathanlie
Copy link
Author

apologies, could you direct me to a specific comment on the issue?

@alan-agius4
Copy link
Collaborator

#13635 (comment)

@angular-automatic-lock-bot
Copy link

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.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Dec 14, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants