systemjs / plugin-babel

SystemJS Babel Plugin
MIT License
82 stars 33 forks source link

Disable es2015 while still being able to build #16

Closed dariocravero closed 8 years ago

dariocravero commented 8 years ago

Hi all,

I'm trying to figure out how to disable es2015 transpiling and still get a single file build through rollup in jspm@beta. While looking at its source, plugin-babel comes with es2015: true by default which I can override in.

I made a fork of jspm-react-component-demo that sets "es2015": false in `"babelOptions" and it stops the transpiling of es2015 features as expected but it doesn't bundle everything into one file as rollup would do, here's the output:

jspm-react-component-demo [es2015-false*] $ jspm build jspm-react-component - react dist/jspm-react-component.js   --format umd --global-name jspmReactComponent --global-deps "{'react':'React'}" --skip-source-maps
     Creating the single-file build for jspm-react-component - react...

       ── jspm-react-component/component.js

ok   Fully-optimized - entire tree built via Rollup static optimization.

ok   Built into dist/jspm-react-component.js, unminified as umd.

This conditional seems to be dealing with it but for some reason it's not outputting the full bundle.

I don't know if this should make any difference at all but I've also tried including babel-plugin-transform-es2015-modules-systemjs like you do when es2015: true but I get the same result.

Would you have any hints on how to fix this if it's an issue or what am I missing if I'm doing the wrong thing? :) Thanks! Darío

guybedford commented 8 years ago

Thanks, added in https://github.com/systemjs/plugin-babel/commit/307aba3dabcc6b042234fc476023e7a2a892a139. The release should be out in the next day or so.

dariocravero commented 8 years ago

Thanks for the quick reply :). I tried that patch and it didn't make a difference to me though :(. Would there be anything else happening around es2015: true that would affect this?

guybedford commented 8 years ago

Thanks for letting me know. I got the conditional backwards! It should work now.

dariocravero commented 8 years ago

Great! That works, thanks. Now, time to understand the bundled output :)

dariocravero commented 8 years ago

So, just to clarify this: the idea is that in the builder you don't want babel to convert exports so that then rollup can take them, right?

guybedford commented 8 years ago

Yes exactly.