rolaveric / karma-systemjs

Karma plugin for using SystemJS as a module loader
MIT License
40 stars 19 forks source link

Babel 6 support #59

Closed kburson closed 8 years ago

kburson commented 9 years ago

Traceur support has dwindled while Babel and Typescript have grown.

Babel 6 is now out and it has exploded into a plethora of plugins, so babel-core is not what it used to be.

Currently in Karma-SystemJS::framework.js you have

return pathOrNpm(config, basePath, 'babel', 'babel-core', '/../../../browser.js');

This file no longer exists in babe-core.

I still want to use SystemJS as my module system, but I want to migrate to Babel, and later to Typescript.

Please update to make use of the new Babel, and cream on top would be to support Typescript transpilation.

Thanks.

rolaveric commented 8 years ago

Looking up the transpiler with require.resolve() (ie. Looking for it under node_modules/ with a static relative path) has been deprecated, for this very scenario. You're better off specifying a paths[transpilerName] value in your SystemJS config based on what you're running. However I will still change the default path for v0.10.0, though this will break anyone not using Babel v6

re: Typescript I don't use Typescript myself so I can't be much help. PRs are always welcome though.

rolaveric commented 8 years ago

Should be fixed by b635b90fe54d21e80b78f07b4d4363886d956f84

xuhcc commented 8 years ago

I'm getting the following error with babel 6.3.21:

ReferenceError: Can't find variable: require
  at node_modules/babel-core/lib/api/browser.js:5

I also found this discussion: https://github.com/babel/babel/commit/c0afdfd1a83aab0c25a1fc23cee0b09d560f4d35

frankandrobot commented 8 years ago

Yea same error here. Unable to use babel 6

plwalters commented 8 years ago

We are looking to upgrade to Babel 6 as well so looking forward to a resolution as well :)

rolaveric commented 8 years ago

Hmmm, if babel's browser.js is deprecated, then I'm not sure. Is anyone currently using Babel 6 with SystemJS or JSPM right now? How does SystemJS handle using babel 6 as it's transpiler at runtime?

mnichols commented 8 years ago

You might want to check out jspm's beta line (v0.17+). that is using babel 6 with a much simper transpilation using the plugin-babel .

rolaveric commented 8 years ago

plugin-babel looks good. Unfortunately there's an issue (#73) where karma-systemjs is including the transpiler through a script tag, rather than letting SystemJS retrieve it. Theoretically I should just be able to set included: false on the file pattern and it should all work, but I want to make sure it doesn't break traceur and typescript too.

frankandrobot commented 8 years ago

So the status is that still no Babel 6 support?

rolaveric commented 8 years ago

Babel 6 support for SystemJS works with plugin-babel