-
Notifications
You must be signed in to change notification settings - Fork 12k
feat(@angular/cli): load reflect only on dev #6295
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
Conversation
4b48ab5
to
ae5eb31
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Blocking for now, discussion is needed regarding the --prod --no-aot
break. Maybe a warning is enough.
I think this should be done by on-the-fly replacement just like the one in bootstrapModuleFactory. |
@ishitatsuyuki some setups might still need it, especially if they are using decorators other than Angular. |
We can make the feature opt-in, and I don't think environment is where we should configure it. Environment is purely runtime credentials, not for build options. |
Does this still work? Tried this locally and with these changes my app doesn't run anymore :)
|
fyi: I run it as: "@angular/*": 4.2.2 |
`reflect-metadata` is not needed in AOT builds.
ae5eb31
to
d3927bf
Compare
I agree with @ishitatsuyuki that it's better be implemented as opt-in build-time replacement than putting polyfills in the environment files. We want to get rid of this polyfill only when doing AoT, not when building for specific environment. And environment is orthogonal to AoT. In my project I have 5 environments, so it's not very convenient to paste polyfills in every environment file just to get this optimization. Also warning will be tricky to implement when running AoT build for the custom environment or without While the obvious benefit of current implementation is simplicity I think it is wrong to abuse environment for this feature. Another point is that current implementation can be done by end user without need to eject or mess up with CLI itself. I would rather have a flag, like |
Is this somehow merged already? Because on a production build
Notice: I removed I can't tell if this was working before, because we rely on rollup for production and thought we'd try angular-cli. Replacing |
This isn't something we're going to do for now. It's pretty risky for projects that need Reflect. An alternative solution will be added in the future. |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
reflect-metadata
is not needed in AOT builds. It's the biggest polyfill and the cause for a significant startup time increase.Note: this will make
ng build --prod --no-aot
builds for new projects not work. The workaround is to movereflect-metadata
back into the common polyfills. We should discuss if this is ok.Fix #6325