systemjs / plugin-babel

SystemJS Babel Plugin
MIT License
82 stars 33 forks source link

Is this work in a webworker ? #26

Closed JonathanDaSilva closed 8 years ago

JonathanDaSilva commented 8 years ago

Hi. I have an angular2 application that I try to convert to webworker.

But when Systemjs try to load an es6 file I have this error.

Error loading http://localhost:8000/systemjs-babel-build as "systemjs-babel-build" from http://localhost:8000/jspm_packages/npm/systemjs-plugin-babel@0.0.8/plugin-babel.js

Everything works fine when I load the same application without the webworker.

I have try to understand what's going on, you seems to load two different files for the browser and node.

Maybe in worker mode the wrong one is loaded ?

If I missed something feel free to ask me.

PS: Sorry for my bad english :(

guybedford commented 8 years ago

Yes, this is something that may need looking into to properly support. Will get to it when I can.

JonathanDaSilva commented 8 years ago

Thank a lot for your work.

guybedford commented 8 years ago

I'm not sure this is a bug actually. The fact that it is loading http://localhost:8000/systemjs-babel-build and not anything else would be due to the configuration. Are you definitely including the SystemJS configuration after loading SystemJS, that sets a map config for systemjs-babel-build?

JonathanDaSilva commented 8 years ago

Okay so I have checked. I was absolutely including the two config files (the browser and normal one), but they weren't the systemjs-babel-build in it. I have not noticed it because the page was loading without it on no-worker mod.

So I have add the map to the file into the config.

    "plugin-babel": "npm:systemjs-plugin-babel@0.0.8",
    'systemjs-babel-build': 'npm:systemjs-plugin-babel@0.0.8/systemjs-babel-browser.js',

I have one concerne about adding things manualy like that into this file, this will be updated in the future in case of an update or I have to update it everytime manualy ?

Thanks a lot for your quick response, and sorry to bother you due to this stupid mistake I haven't checked my config because that was working without it…

guybedford commented 8 years ago

This is a bug, you're completely right.

I've added a fix in https://github.com/systemjs/plugin-babel/commit/8ff3bc56f856300338ca398f34eb5e3b1cae92c8.

JonathanDaSilva commented 8 years ago

I was not saying that was the fault of the plugin but maybe mine :D.

But anyway thank lot, this will be easier for the next people.

PS: I leave this open, feel free to close it.

guybedford commented 8 years ago

I will keep this open until the fix is released.

guybedford commented 8 years ago

I've also created https://github.com/systemjs/systemjs/issues/1186 to expand on the underlying cause.

guybedford commented 8 years ago

This has now been released in 0.0.9.