Skip to content
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

Fix tree shaking removing code needed for handling ng-content in production builds #14

Merged
merged 1 commit into from
Sep 6, 2018

Conversation

bengry
Copy link
Contributor

@bengry bengry commented Sep 6, 2018

Fixes #13

Angular CLI's Webpack default seems to be pretty aggressive (or there's a bug in one of them), where it removes actual code that should be executed.
This manifested itself already in #8 (fixed by #9).

We need to account for this when writing code in the library - not to write any code that's going to be executed by just loading the scripts, since it may get removed.

Moving the registrations of both Disguise and ReactContent components to the ReactRenderer makes sense, since you're supposed to have one per app, and we're guaranteed that its constructor will get executed.

@benfeely Following this, it may be worth re-considering if we want to make the registry an actual Angular Service (i.e. @Injectable). We discussed this a few months ago but decided to leave it as-is then.

@bengry bengry merged commit 5c15bd2 into master Sep 6, 2018
@bengry bengry deleted the bugfix/render-content-fails-optimized branch September 7, 2018 14:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Components with Angular content in them don't render the content in production build
2 participants