angular-cli icon indicating copy to clipboard operation
angular-cli copied to clipboard

IE 11 Syntax error after doing ng serve

Open babupca opened this issue 8 years ago • 29 comments

Versions Angular CLI: 1.6.5 Node: 6.10.2 OS: win32 x64 Angular: 4.4.6 ... animations, common, compiler, compiler-cli, core, forms ... http, language-service, platform-browser ... platform-browser-dynamic, router, tsc-wrapped

angular/cli: 1.6.5 angular-devkit/build-optimizer: 0.0.41 angular-devkit/core: 0.0.28 angular-devkit/schematics: 0.0.51 ngtools/json-schema: 1.1.0 ngtools/webpack: 1.9.5 schematics/angular: 0.1.16 typescript: 2.3.4 webpack: 3.10.0

Repro steps

  1. Entered ng serve in the VS Code terminal
  2. The app successfully created
  3. when entered the http://localhost:4200, the app work in mozilla and chrome, But when checked in the IE 11 browser it is throwing error in vendor.bundle.js file. Initially it was running fine, but now error is coming. We could not able to analyze, because of what problem, this error is occurs.

Just want to say here, i have attached the polyfill.js for the app in the IE browser to work.

I have attached the screenshot of the error in the IE browser and also package.json, angular-cli.json and polyfill also.

Kindly give us some insight about how to debug this type of errors.

angular-cli.txt package.txt polyfills.txt

Observed behavior D:\CSC\release1.1.1\samplemodernization-app>ng serve ** NG Live Development Server is listening on localhost:4200, open your browser on http://localhost:4200/ ** Date: 2018-02-05T04:13:11.511Z Hash: 5f441295e975bb6b926b Time: 29891ms chunk {inline} inline.bundle.js (inline) 5.79 kB [entry] [rendered] chunk {main} main.bundle.js (main) 2.04 MB [initial] [rendered] chunk {polyfills} polyfills.bundle.js (polyfills) 990 kB [initial] [rendered] chunk {scripts} scripts.bundle.js (scripts) 438 kB [initial] [rendered] chunk {styles} styles.bundle.js (styles) 923 kB [initial] [rendered] chunk {vendor} vendor.bundle.js (vendor) 14 MB [initial] [rendered]

webpack: Compiled successfully.

Desired behavior

When i run ng serve, the app should work in all the latest browsers like IE ,chrome and mozilla

vendor bundle_error vendor bundle_error_expanded Thanks a lot.

babupca avatar Feb 05 '18 05:02 babupca

@fuyuko-akiyoshi @noamichael How did you manage to find which script is causing the issue?

burakuytun-rightsoft avatar Aug 14 '18 23:08 burakuytun-rightsoft

@burakuytun-rightsoft I ran the app in development mode and looked at the IE console which gave a stacktrace. The top element of the stacktrace was the last line to execute before the error, so I analyzed the code and saw it was Foundation Sites.

noamichael avatar Aug 14 '18 23:08 noamichael

@noamichael thanks for the answer.

I also did the tracing but just points to class AnimationBuilder and stops there. This issue has been a pain for us really...

burakuytun-rightsoft avatar Aug 14 '18 23:08 burakuytun-rightsoft

@burakuytun-rightsoft I opened the console and clicked on the Syntax error link and it jumped into bundles.js and it highlighted the line that had a class declaration. Diving into that code I saw that it was one of my third party scripts which for some reason doesn't get transpiled properly. Good luck.

fuyuko-akiyoshi avatar Sep 19 '18 02:09 fuyuko-akiyoshi

I had a look at this and from what I am seeing is that punycode as shipping only ES2015 sources. In Angular-CLI we don't perform any downleveling as we assume that the library is providing the needed sources.

Please contact the author(s) of the punycode project or file an issue on their issue tracker.

alan-agius4 avatar Oct 01 '18 10:10 alan-agius4

@fuyuko-akiyoshi

I ended up fixing this by importing the offending script globally through angular.json. For whatever reason one of my 3rd party scripts was getting compiled incorrectly if I imported using the import statement. Now I import it globally and it's working fine.

hi can please show how did you do the import. sorry im just new in the platform

mavconvento avatar Oct 22 '18 08:10 mavconvento

@mavconvento open angular.json and where it says "scripts":[] add your script like this:

image

fuyuko-akiyoshi avatar Oct 22 '18 20:10 fuyuko-akiyoshi

What worked for me is making some changes in the tsconfig.json file. Make sure that "target" is for "es5" and "lib" is "2016"

nsaban avatar Jan 23 '19 10:01 nsaban

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.