Problems viewing ES6 original source in browser after broadcast with Babel

That's it, I'm using SystemJS with Babel as a transpiler to learn how to generate ES5 code from ES6 in my browser. When I try to view the source using Chrome Dev tools, I see ES5 code, not original ES6 code. I am using the default babelOptions

in my SystemJS config.js

like:

System.config({
  "transpiler": "babel",
  "babelOptions": {
    "optional": [
      "runtime"
    ]
  },
  ...

      

I can see inline source maps inserted at the bottom of the generated Javascript with the form:

//# sourceMappingURL=data:application/json;base64,...

      

Shouldn't Chrome interpret this line and show ES6 code instead of ES5 code? Am I misunderstanding how the embedded source maps are supposed to work? (I tried this in Chrome 43.0.2357.65 and 45.0.2411.0. I also tried unsuccessfully with Firefox 38.01. I am using Mac OS X 10.10.2.) Any help would be appreciated.

+3


source to share


1 answer


Which panel are you viewing the source on? On the network pane, it should only show ES6 source as this is what is booted over the network. The Sources panel should have 2 files in the path that was loaded:

enter image description here



As you can see, systemjs dynamically translates login.js and calls it login.js! transpiled.

0


source







All Articles