-
Notifications
You must be signed in to change notification settings - Fork 12k
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
feat(@angular/cli): support sourcemaps and minification in scripts #7279
Conversation
94e9bdc
to
27332f0
Compare
6518767
to
3ab491b
Compare
This PR also ensures lazy loaded scripts do not have a hash. There wasn't an issue opened for that but it was a bug. |
3ab491b
to
02c28b3
Compare
Adds sourcemap and minification to javascript added via the `scripts` array in `.angular-cli.json`. `script-loader` is no longer used, which should help with CSP since it used `eval`. Scripts will no longer appear in the console output for `ng build`, as they are now assets instead of webpack entry points. It's no longer possible to have the `output` property of both a `scripts` and a `styles` entry pointing to the same file. This wasn't officially supported or listed in the docs, but used to be possible. Fix angular#2796 Fix angular#7226 Fix angular#7290 Related to angular#6872
02c28b3
to
08b514a
Compare
Does this also resolve #6166? |
I tried a quick update to cli 1.4.0.rc2 to test this out but quickly ran into issues. We're loading our legacy scripts and vendor files using global scripts. I'm a little bit out of my wheel house here, but it seems that with the new loader, "this" is not automatically bound to Window. Instead "this" is undefined. For instance, the sample script below will no longer work, as "this" is undefined. (function() {
var body = this.jQuery('body');
})(); Downgrading to cli 1.3.2 will allow the script above to work. Needless to say, this cause complete havoc on our legacy scripts and vendor scripts. |
Heya @franktroia, thanks for testing this feature. I'm very interested in the problem you're having, but couldn't reproduce it. On a new project I added
Then ran Can you open a new issue with a repro and ping me on it so I can investigate? |
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. |
Adds sourcemap and minification to javascript added via the
scripts
array in.angular-cli.json
.script-loader
is no longer used, which should help with CSP since it usedeval
.Scripts will no longer appear in the console output for
ng build
, as they are now assets instead of webpack entry points.It's no longer possible to have the
output
property of both ascripts
and astyles
entry pointing to the same file. This wasn't officially supported or listed in the docs, but used to be possible.Fix #2796
Fix #7226
Fix #7290
Related to #6872