Skip to content

should scripts be compile into scripts.bundle.js instead of using script-loader? #7290

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
zh99998 opened this issue Aug 7, 2017 · 2 comments · Fixed by #7279
Closed

should scripts be compile into scripts.bundle.js instead of using script-loader? #7290

zh99998 opened this issue Aug 7, 2017 · 2 comments · Fixed by #7279

Comments

@zh99998
Copy link

zh99998 commented Aug 7, 2017

Bug Report or Feature Request (mark with an x)

- [ ] bug report -> please search issues before submitting
- [x] feature request

currently global scripts are loaded by script-loader. which can't be optimize or minify, and can break some library rely on global context

library1.js

'use strict'
var library1 = function(){...}

another script rely on library1

library1(...)

they works well in traditional non-webpack environment, but currently they can't work because eval() is not allowed to add variable to context in strict mode.

since angular-cli is not allowed to modify webpack.config.js to use custom loaders.
is there any way to work-around let such a library script work now?

@zh99998 zh99998 changed the title should scripts be compile directly into scripts.bundle.js instead of using script-loader? should scripts be compile into scripts.bundle.js instead of using script-loader? Aug 7, 2017
@clydin
Copy link
Member

clydin commented Aug 7, 2017

It's something that is being looked at currently. The removal of eval has numerous benefits; CSP being an important one.

filipesilva added a commit to filipesilva/angular-cli that referenced this issue Aug 15, 2017
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
filipesilva added a commit to filipesilva/angular-cli that referenced this issue Aug 16, 2017
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
filipesilva added a commit to filipesilva/angular-cli that referenced this issue Aug 17, 2017
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
Brocco pushed a commit that referenced this issue Aug 17, 2017
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 #2796
Fix #7226
Fix #7290

Related to #6872
dond2clouds pushed a commit to d2clouds/speedray-cli that referenced this issue Apr 23, 2018
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
@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 7, 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

Successfully merging a pull request may close this issue.

2 participants