Open ianobermiller opened 8 years ago
I'd appreciate if someone could look into the correct webpack configuration + tooling to make this happen!
Some info on getting Babel to export ES6 modules rather than CommonJS: http://www.2ality.com/2015/12/webpack-tree-shaking.html https://www.npmjs.com/package/babel-preset-es2015-webpack2
What if we publish as a tag on NPM? radium@es6
could provide the pure ES6 modules, requiring babel-preset-es2015
at minimum.
I've got tree-shaking working in the Radium archetype: https://github.com/FormidableLabs/builder-radium-component/commit/8b68ee930cf3ab48f32969f5a20d5e70b6f9bf60
What would be a good convention for which folder the ES6 modules go in? Is it equivalent to what's in src/
? Maybe an es6
folder with a package.json tagged as radium@0,17.0-es6
?
Maybe lib-es6
?
If we publish an es6
-specific tag and npm module, I think we could just replace lib/
with the es6
modules.
Since
radium
(néeradium-ui
) will become an aggregator module, it would be really cool if we could figure out a way to publish an ES6 version of the code (that only requiresbabel
'ses2015
preset) so that users don't have to import individual modules to avoid code bloat. As long as they use tooling likerollup
orwebpack2
, tree-shaking or dead-code elimination will happen automatically.