npm-es-modules-3-esm-rollup
v0.0.2
Published
Breakdown of 7 different ways to use ES modules with NPM today.
Downloads
2
Maintainers
Readme
npm-es-modules-3-esm-rollup
Breakdown of 7 different ways to use ES modules with npm today.
This approach uses esm for Node.js and babel+rollup to compile browser source files.
- Source files end in
.mjs
- One exception is the commonjs entrypoint,
main.js
.
- One exception is the commonjs entrypoint,
- Supports all three targets
main
module
, andbrowser
- The only target that is compiled is
browser
, making debugging the Node.js version easier
Approaches
- naive - The most naive possible use of ES modules supporting our functionality. This approach is broken and provided as an example starting point.
- babel - Uses babel to transpile all Node.js and browser source files.
- esm-rollup - Uses esm for Node.js and babel+rollup to compile browser source files.
- esm-webpack - Uses esm for Node.js and babel+webpack to compile browser source files.
- rollup - Uses babel+rollup to compile all Node.js and browser source files.
- webpack - Uses babel+webpack to compile all Node.js and browser source files.
- typescript - Uses typescript to transpile all Node.js and browser source files.
License
MIT © Travis Fischer