Skip to content

Lazy loading breaks with 3rd party library #2967

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
slubowsky opened this issue Oct 31, 2016 · 5 comments
Closed

Lazy loading breaks with 3rd party library #2967

slubowsky opened this issue Oct 31, 2016 · 5 comments

Comments

@slubowsky
Copy link

slubowsky commented Oct 31, 2016

Please provide us with the following information:

OS?

Windows 10

Versions.

angular-cli: 1.0.0-beta.19-3
node: 7.0.0
os: win32 x64

Repro steps.

(See comments below. Added link to project showing issue)
Generate simple app add simplest lazy loading. (#2865 with fix as described there might be a good starting point). Make sure multiple bundles created. Add an ng2-bootstrap alert as described at https://github.com/valor-software/ng2-bootstrap/blob/development/docs/getting-started/ng-cli.md. Lazy loading stops working, Only one bundle created. (Would attach project here with the described changes already included but github not allowing the attachment for some reason. Pretty simple to reproduce as above though)

See also valor-software/ngx-bootstrap#1187

The log given by the failure.

No error

Mention any other details that might be useful.

Dont know if this a cli issue or a ng2-bootstrap issue.

@Meligy
Copy link
Contributor

Meligy commented Nov 1, 2016

Hello,

Can you please try to fork https://github.com/meligy/routing-angular-cli, and try to reproduce the issue in that repo, and push it to github, link to it here?

The only thing I remember that might be related is when you have barrels (index.ts file that export * from all files in the directories, or other modules), which I think broke lazy loading somewhere, but I'm unable to find a relevant issue now. The above repo is a good start as it already has lazy loading setup, you just include the alert and see if it continues to work.

Thanks a lot.

Cheers,

@slubowsky
Copy link
Author

@Meligy Great idea, thanks.
Forked repo is at https://github.com/slubowsky/routing-angular-cli
Before changes ng-serve builds with 2 bundles, main.bundle and 0.chunk
chunks
Make exactly three changes:
1 - add ng2-bootstrap to package.json
2 - import a module from it in app.module.ts
3 - add the module to AppModule imports
Now only one bundle, main.bundle
nochunks

(Note to actually use the module add <alert type="success">hello</alert> to app.component.html. To make it look right add bootstrap css. Just importing it as above without actually using it is enough to break lazy loading)

@JiriBalcar
Copy link

Is this duplicate with #2496?

@slubowsky
Copy link
Author

@JiriBalcar Yes. Looks like it is. See #2496 (comment) which addresses ng2-bootstrap directly and thats probably the issue referenced by @Meligy above

@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 Sep 6, 2019
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

3 participants