esnext-demo
esnext-demo copied to clipboard
Enable pkg.esnext for *untranspiled* source code
esnext-demo
This repo shows how to enable pkg.esnext for untranspiled source code.
What is transpiled by Babel?
If you build this repo, Babel transpiles:
- All JavaScript files inside
esnext-demo/js - All npm-installed modules that have a
package.jsonwith the propertyesnext.- That property works similarly to
main: it points to the.(m)jsfile “implementing” the package.
- That property works similarly to
- No other JavaScript file is transpiled by Babel.
Rationale and future
-
Rationale for the
package.jsonpropertyesnext: http://2ality.com/2017/04/transpiling-dependencies-babel.html -
At the moment, webpack does not support nested properties in resolve.mainFields. Once it does:
resolve: { mainFields: ['esnext.main', 'esnext', 'browser', 'module', 'main'], },
Installation
cd esnext-demo
npm install
npm run install-aaa
Running the web app
npm run wp
open esnext-demo/index.html