What is the current best practice for creating a module in ES6 that is compatible with npm, browser/bower (script src="" tag), and JSPM/SystemJS? Thought is to use babel to transpile the ES6 to UMD for npm and bower then add a `jspm.main` property in package.json to point to the ES6 module.
However as discussed in detail in this issue https://github.com/systemjs/systemjs/issues/304 there is a difference in the way babel handles default exports and the way SystemJS works. Since adding `export var __useDefault = true;` breaks babel to UMD and without it means something ugly like `require('myMod').default` in SystemJS how can one write a ES6 module that is cross universal... with the same API in each.
I think my choices are:
a) Give up on ES6 and just write CJS, wrap it in UMD.
b) Have SystemJS/JSPM point to the same generated UMD file as node/browser.
c) Write a shim for SystemJS that looks something like this: `module.exports = require('path/to/es6file.js').default`.
Any thoughts? Thank you.
P.S. Sorry for asking the same question I posed on gitter, my time zone makes the chat rooms difficult.
--
You received this message because you are subscribed to the Google Groups "SystemJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to systemjs+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--