systemjs / systemjs

Dynamic ES module loader
MIT License
12.94k stars 1.08k forks source link

Syntax error inside system.src.js on ie11 #1457

Closed NicholasPhillips closed 8 years ago

NicholasPhillips commented 8 years ago

Currently working to get my Angular2 Rc.5 + SystemJs + Gulp project working in Internet Explorer. Everything is working as expected in chrome.

The syntax error stack that IE gives me is:

"SyntaxError: Syntax error at __exec (http://localhost:3000/lib/systemjs/dist/system.src.js:1510:10) at Anonymous function (http://localhost:3000/lib/systemjs/dist/system.src.js:3389:11) at Anonymous function (http://localhost:3000/lib/systemjs/dist/system.src.js:3657:5) at Anonymous function (http://localhost:3000/lib/systemjs/dist/system.src.js:3933:7) at Anonymous function (http://localhost:3000/lib/systemjs/dist/system.src.js:4260:7) at Anonymous function (http://localhost:3000/lib/systemjs/dist/system.src.js:4521:9) at Anonymous function (http://localhost:3000/lib/systemjs/dist/system.src.js:428:9) at ZoneDelegate.prototype.invoke (http://localhost:3000/lib/zone.js/dist/zone.js:201:13) at Zone.prototype.run (http://localhost:3000/lib/zone.js/dist/zone.js:96:17) at Anonymous function (http://localhost:3000/lib/zone.js/dist/zone.js:462:17)"

The specific line it seems to be complaining about is: (0, eval)(getSource(load));

My index file is

<!DOCTYPE html>
<html>
  <head>
    <base href="/">
    <title>Example</title>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet">
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.6.4/css/bootstrap-datepicker.min.css">
    <link rel="stylesheet" href="css/bootstraptheme/style.css">
    <link rel="stylesheet" href="css/style.css">
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.6.4/js/bootstrap-datepicker.min.js"></script>
    <script src="css/bootstraptheme/homer.js"></script>
    <script src="lib/core-js/client/shim.min.js"></script>
    <script src="lib/zone.js/dist/zone.js"></script>
    <script src="lib/reflect-metadata/Reflect.js"></script>
    <script src="lib/systemjs/dist/system.src.js"></script>
    <script src="lib/.tmp/Rx.js"></script>
    <script src="systemjs.config.js"></script>
    <script>
      conf = JSON.parse(decodeURIComponent("#{encodeURIComponent(JSON.stringify(conf))}"));
      System.import('app').catch(function(err) { console.error(err); });
    </script>
  </head>
  <body>
    <my-app>
      Loading...
    </my-app>
  </body>
</html>

Version of systemjs is 0.19.27.

tsconfig.json :

{ "compilerOptions": { "target": "es6", "module": "system", "moduleResolution": "node", "sourceMap": true, "emitDecoratorMetadata": true, "experimentalDecorators": true, "removeComments": false, "noImplicitAny": false }, "exclude": [ "gulpfile.js", "node_modules" ] }

Let me know if you need any other files.

guybedford commented 8 years ago

This is an error inside of evaluated code, but not showing the correct source due to limited support for source maps in IE. If you were to for example add console log statements into the codebase you would be able to track this down, it's a pain though certainly.

NicholasPhillips commented 8 years ago

Ah i see thanks for the advice Ill get some logging in there.

NicholasPhillips commented 8 years ago

Updated to systemjs version 0.19.39 to see if anything changed and i get a different error.

Error loading http://localhost:3000/app/app.module.js as "./app.module" from http://localhost:3000/app/main.js"

Logging to the console anywhere inside my app doesn't appear in the ie dev console. The only thing i can actually guarantee is that the systemjs.config.js runs correctly and that the inital network calls are to get main.js and then app.module.js. At which point it loads several angular bundles from my /lib folder but nothing else.

No matter what i change in app.module.js i seem to get the same error. Even removing any extra imports (tooltips, modal and anything not angular2 related) to see if that changes the error.

It fails specifically in system.src.js on the code below but I am guessing the same applies as said before that its evaluated code and therefore not really useful. Thought I would include it anyway just to check I've not missed anything.

var nativeURL = new __global.URL('test:///').protocol == 'test:';

NicholasPhillips commented 8 years ago

My tsconfig was set to "target": "es6", changed it to es5 and it then worked correctly in IE11.

irejwanul commented 7 years ago

My tsconfig was set to "target": "es6", changed it to es5 and it then worked correctly in IE11.