systemjs / plugin-babel

SystemJS Babel Plugin
MIT License
82 stars 33 forks source link

question: extracting build process to a separare module #32

Closed douglasduteil closed 8 years ago

douglasduteil commented 8 years ago

Hi there

I had a very hard time understanding how this plugin works. I'm still a bit moved by the forced fixed Babel version and the use of traceur to compile concat Babel sources for node and the browser.

Can you give more input over those choices ?

Any way I'm currently forking your build step to a separate CLI to be able to bundle any Babel and babel plugin version I want in systemjs ready format.
It will ideally look like that :

# using the .babelrc config file + the installed files in the node_modules (if possible)
systemjs-babel-build -o my-systemjs-babel-build.js
guybedford commented 8 years ago

Plugins in SystemJS implement the translate hook. This is shared between the browser and Node so that module loading is handled equivalently in all environments, releasing the build process from OS-requirements, a key idea in SystemJS and jspm.

This translation can be run on its own by using builder.compile('module/name.js'), the individual module compile API provided by SystemJS builder.

The use of Traceur was actually just deprecated recently pending the next release of SystemJS builder so we now use only Babel for ES module transpilation.

If you want to do your own Babel compilation, that is fine too - the translate hook / SystemJS plugin doesn't have to be used. Just run Babel with the system modules output instead and SystemJS can load files compiled in that way.

douglasduteil commented 8 years ago

Alright thanks