Skip to content

Latest commit

 

History

History

5-rollup

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

npm-es-modules-5-rollup

Breakdown of 7 different ways to use ES modules with npm today.

NPM Build Status JavaScript Style Guide

This approach uses babel+rollup to compile Node.js and browser source files.

  • Source files end in .mjs
  • Supports all three targets main module, and browser
  • All three targets are compiled via rollup, with Node.js and the browser having two separate configs
  • This is our first module to support node >= 4 (or whatever we specify in our babel-preset-env config) instead of node >= 8
  • Source maps are generated along with the compiled targets

Approaches

  1. naive - The most naive possible use of ES modules supporting our functionality. This approach is broken and provided as an example starting point.
  2. babel - Uses babel to transpile all Node.js and browser source files.
  3. esm-rollup - Uses esm for Node.js and babel+rollup to compile browser source files.
  4. esm-webpack - Uses esm for Node.js and babel+webpack to compile browser source files.
  5. rollup - Uses babel+rollup to compile all Node.js and browser source files.
  6. webpack - Uses babel+webpack to compile all Node.js and browser source files.
  7. typescript - Uses typescript to transpile all Node.js and browser source files.

License

MIT © Travis Fischer