test-es6-module-with-commonjs
v0.1.7
Published
Text NPM package ESModule implementing CommonJS dual export
Downloads
19
Readme
ESM Package (with Hybrid CommonJS support)
Concept for publishing an NPM ESM package (with CommonJS backward):
- Create an ESModule package (in
./src){type:"module"} - On publish use Babel to transpile (in
./lib) -> Also add{"type":"commonjs"}on./lib/package.jsonfile. - use
./node_modules/.binon script to avoid using global on another environment. - Store only
./srcon dit (./liband./node_modulesare useless) - Before Publishing, transpile the package (Root-Project's Babel who'll use commonjs version of this package will not bundle dependencies)
Links
- Add link about Doc/Design/ESM
- Hybrid ESM/CommonJS Packages
- StackOverflow - How to publish a module written in ES6 to NPM?
Note
- script
transpile:jsis probably useless (but in case we need to provide a minimify version ?)
