-
Notifications
You must be signed in to change notification settings - Fork 12k
Angular 5 to 6: Internet Explorer, Loading chunk failed (caused by function rest parameters) #11881
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
Comments
Is there any hack to overcome this issue? Not supporting ie 11 is quite a regression. |
For anyone supporting IE, this is a major issue. Any feedback on the status of this issue would be highly appreciated. |
The code in question appears to originate from a third-party module. Is For an explanation regarding the chunks, please see this comment: #10364 (comment) |
@clydin yes, we're using Plotly.js angular.json
I'm a bit confused because scripts references the minified file, which I expect would be used regardless of Angular
node_modules/plotly.js/dist/plotly.js
You can look at dist/plotly.js on GitHub and it isn't using Rest Parameters. But in my Angular Dist
Is it possible that the build system is optimizing the code and converting it to use Rest Parameters??? I think Plotly type imports are causing it to be pulled into the build. For example: |
I'm not aware of anything in our toolchain adding spread operators. What you add to the scripts array should only go into the scripts bundle too, so if you're seeing this in one of your other bundles then maybe you are importing plotly directly? Best thing I can say is to setup a minimal reproduction and we can try and debug it as well. You can read here why this is needed. A good way to make a minimal repro is to create a new app via |
It is here though: https://github.com/dy/point-cluster/blob/master/quad.js#L155 It appears that the project is importing and bundling the library and all of its dependencies. |
Yes, something is importing I attempted to reproduce with a new project and wasn't able to. I only import types (from I'll review my project in more detail. I'll review my project config in more detail and try to figure out what's loading Plotly this way. |
In my I've double-checked this twice because it seemed doubtful. But yes, this one little change to the import line makes the difference. My I think this issue should remain open for now because this seems like a strange way for the build system to behave. I will try to reproduce the problem in new cli project next week. |
@arlowhite in this case the build system is behaving as it should: it is including the referenced code. We do not police packages that ships ES2015 code (e.g. with rest operators) in their non-ES2015 entry points. You should bring this packaging issue up with the package is doing this. I suggest looking directly inside of your node_modules files to find the offending code. |
I just accidentally introduced this issue in my project again.
What's odd to me, is that using different interface types causes a significant change in the angular/cli build. In this case, the fix was (from broken to fixed): Index: src/app/visualization/plotly/plotly.component.ts
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- src/app/visualization/plotly/plotly.component.ts (date 1547506923000)
+++ src/app/visualization/plotly/plotly.component.ts (date 1547683661000)
@@ -83,7 +83,7 @@
* xaxis and yaxis are set separately.
* Plotly mutates this object on label change
*/
- @Input() layout: Partial<PlotlyLayout>;
+ @Input() layout: Partial<Layout>;
@Input() config: Partial<Config> = {};
@@ -469,8 +469,8 @@
}
// TODO execute with ngOnChanges to layout input?
- createLayout(): Partial<PlotlyLayout> {
- let layout: Partial<PlotlyLayout> = Object.assign(
+ createLayout(): Partial<Layout> {
+ let layout: Partial<Layout> = Object.assign(
{
autosize: true,
},
Both of these types are imported in both the working and broken states. Only the lines in the patch above changed.
export interface PlotlyLayout extends Layout {
// missing from @types/plotly.js
barmode: 'stack' | 'group' | 'relative';
boxmode: 'group' | 'overlay';
xaxis: Partial<PlotlyAxis> & {
showdividers?: boolean;
};
} Again, these are TypeScript interfaces, not classes preserved at runtime. In the working state @Output()
layoutChange: EventEmitter<PlotlyLayout> = new EventEmitter<PlotlyLayout>(); And yet reversing the patch above (using PlotlyLayout on just those few lines) causes the angular/cli build system to pull I load plotly.js via scripts and angular/cli doesn't include it in the build except for when this bug occurs. "scripts": [
"node_modules/plotly.js/dist/plotly.min.js"
] In my tsconfig.json I have: "paths": {
"app/*": ["src/app/*"],
"api-types/*": ["src/api-types/*"]
}, which I think is non-standard. Maybe this is a contributing cause? |
@arlowhite does this still happen with the latest CLI versions? If so, can you setup a simple repro that we can investigate? |
@filipesilva We'll update our project to Angular 7 in about 2 weeks. I'll try to reproduce it then. If I can reproduce it with Angular 7, I'll try to understand the cause and build a simple reproduction. |
I could confirm that we have on Angular 7.2 same situation with chunks. IE can't read the chunk and breaks the app |
I'm having the same issue too. |
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. |
Bug Report or Feature Request (mark with an
x
)Command (mark with an
x
)Have not tested serve with IE.
Versions
Node v8.11.3
npm 6.3.0
Angular CLI: 6.1.3
Node: 8.11.3
OS: linux x64
Angular: 6.1.2
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router
TL;DR and Status
After upgrading to Angular 6, this project's build started to include dependencies of
plotly.js
that use function rest parameters syntax, which is not supported by Internet Explorer 11.This seems to be caused by a combination of certain
plotly.js
imports and redundancy in the project's modules where two different modules importPlotlyComponent
and other modules import both of those.Arlo will try to reproduce this module setup in a new cli project Aug 20-24
Repro steps
Our application was working with Internet Explorer 11 previously.
We upgraded from angular/cli 1.7.4 to 6.1.3 and went through the Angular 6 upgrade process.
polyfills
verified polyfills match a new 6.1.3 project. The meant adding this line:
import 'core-js/es6/weak-map';
Commented animations, which we had previously enabled:
// import 'web-animations-js';
build
ng build --prod --deploy-url "/dashboard-dist/x.y.z/"
(x.y.z is our application version, this path is how we serve the dist)
angular.json
error occurs with optimization true or false.
The log given by the failure
The app loads in Edge, Chrome, Firefox, Safari.
Using Internet Explorer 11
The app loads partially. AppModule, CoreModule, AppComponent seem to load fine.
These JavaScript files execute fine: runtime, polyfills, scripts, main
After that, a series of chunks with multiple module names are loaded. The 2nd file (accord to network file load order) has an error.
https://MYHOST.com/dashboard-dist/2.6.1-45-g4b99f71/band-aid-band-aid-module-ngfactory~demo-demo-module-ngfactory~press-overflow-press-overflow-module-n~a0d51d90.038dae500f4276aa6c84.js
Error Mesages
SCRIPT1010: Expected identifier
Error: Loading chunk MYCHUNK failed.
with optimization=false, this line is
My guess is that Internet Explorer does not support the Array spread operator. Is this the case?Internet Explorer does not support function Rest Parameters
Here is
tsconfig.json
I tried adding
"downlevelIteration": true
but it didn't fix the issue.Here are those chunks (with --named-chunks on). The error is with the second of these (the first is harmony export/imports and does not contain rest parameter syntax). These load in all browsers. What are these chunks?
band-aid, press-overflow, demo, admin are all are lazy-loaded and I don't expect them to be loading on the homepage. I'm wondering if there's some kind of dependency problem causing them to be loaded early. However, since the app works in other browsers this seems like a separate issue.
Desired functionality
Internet Explorer 11 should work as it did in Angular5 with cli 1.7.4
Troubleshooting Tips
For anyone encountering a similar issue.
The Internet Explorer error is due to unsupported JavaScript syntax. In my case, the build system was pulling in raw dependencies of
plotly.js
from mynode_modules
.In
angular.json
set"optimization": false,
node_modules
to find the dependency, which wasplotly.js
in my case (node_modules/plotly.js/dist/plotly.js) and its dependency (node_modules/point-cluster/quad.js)The text was updated successfully, but these errors were encountered: