Run ES modules in the browser with minimal modifications. No concatenation, no minfication.
Uses babel to parse ES6 code and re-writes import/export file statements by appending .js
and resolving paths in node_modules
.
ESM Libraries:
$ npm install
$ node babelparser.js
It will create a build
folder with index.html
and ESM files.
Because React's npm module is a 💩and is not ES6-compliant / ESM, use rollup to create a bundle with cjs.
$ npm run rollup
The bundles will be in the build
folder with bundle.html
In the build
folder, run a simple HTTP server with python:
$ python -m SimpleHTTPServer 2000 # Python 2
$ python3 -m http.server 2000 # Python 3
Open http://localhost:2000
or http://localhost:2000/bundle.html