angular: IE11 Polyfills Issue - SCRIPT1002: Syntax error main.bundle.js

I’m submitting a…


[ ] Regression (a behavior that used to work and stopped working in a new release)
[x ] Bug report  
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question

Current behavior

I cannot open the project in IE11. The following error is thrown - SCRIPT1002: Syntax error main.bundle.js

I have done the following steps after investigating the issue a couple of hours:

  1. Enabled polyfills
  2. Added shims to index.html - https://npmcdn.com/angular2/es6/dev/src/testing/shims_for_IE.js
  3. Set __Zone_enable_cross_context_check property to true in index.html file.
  4. Set es5 in tsconfig files.

Expected behavior

Minimal reproduction of the problem with instructions

A fully runnable sample is available here - https://github.com/danail-vasilev/test-ng2-ie11 Just clone the repo and run: npm install npm start

What is the motivation / use case for changing the behavior?

Environment


Angular version: X.Y.Z


Browser:
- [ ] Chrome (desktop) version XX
- [ ] Chrome (Android) version XX
- [ ] Chrome (iOS) version XX
- [ ] Firefox version XX
- [ ] Safari (desktop) version XX
- [ ] Safari (iOS) version XX
- [x] IE version 11
- [ ] Edge version XX
 
For Tooling issues:
- Node version: XX  
- Platform:  

Others:

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 24 (10 by maintainers)

Most upvoted comments

I am also facing the running issue with IE11. I already uncommented required import statement from polyfills. It is not working for me. I am getting an error in the vendor.js “const ucs2encode = array => String.fromCodePoint(array);” Does anyone faced the same issue.

@danail-vasilev , about the registry, by default, it not exists, so you need to create the keys yourself, I also tried those settings in Windows 10.

And about the point3 .

So, as per the issue discussion, I have concluded the following: The problem occurs only when you open the console in IE11 and it doesn’t break the functionality. If you just don’t want to see the exception during development you can set the __Zone_enable_cross_context_check property to true but in production it shouldn’t be set in order to avoid performance issue. If that is the case you can mention that in the comment of the fix that has just been merged. Thank you !

in fact, there are several issues related with IE.

  1. if you compile the project with target -> es6, IE will not work and throw error like Syntax error.
  2. if you open developer tools and without set the __Zone_enable_cross_context_check flag, the error like Can't execute code from a freed script may occur. in this case, you should set the flag to true in polyfill, it will have some performance impact so you should only do this in dev mode.
  3. About the error SecurityError, I believe this is the websocket error with dev server. so you should try the registry way.

I would like to make a PR to add those information as trouble shooting in aio document (I am not sure it is the right place) later.

I am facing the same issue. The culprit seems to be punycode@2.1.1 included by @angular-devkit. This is my dependency tree:

eang@0.0.0
| Reactive components for Angular with customizable UX themes
+-- @angular-devkit/build-angular@0.6.8
|   | Angular Webpack Build Facade
|   | git+https://github.com/angular/devkit.git
|   | https://github.com/angular/devkit
|   +-- ajv@6.4.0
|   |   | Another JSON Schema Validator
|   |   | git+https://github.com/epoberezkin/ajv.git
|   |   | https://github.com/epoberezkin/ajv
|   |   `-- uri-js@3.0.2
|   |     | An RFC 3986/3987 compliant, scheme extendable URI/IRI parsing/validating/resolving library for JavaScript.
|   |     | git+ssh://git@github.com/garycourt/uri-js.git
|   |     | https://github.com/garycourt/uri-js
|   |     `-- punycode@2.1.1
|   |       A robust Punycode converter that fully complies to RFC 3492 and RFC 5891, and works on nearly all JavaScript platforms.
|   |       git+https://github.com/bestiejs/punycode.js.git
|   |       https://mths.be/punycode