Created
March 26, 2017 08:26
-
-
Save cjies/31b602b53adf22320936663756abd61f to your computer and use it in GitHub Desktop.
es module bundling with babel
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Show hidden characters
{ | |
"presets": [ | |
["env", { "modules": false }] | |
], | |
"env": { | |
"es": {}, | |
"lib": { | |
"plugins": [ | |
"transform-es2015-modules-commonjs" | |
] | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "es-module-bundling-demo", | |
"version": "1.0.0", | |
"description": " es module bundling with babel", | |
"main": "lib/index.js", | |
"module": "es/index.js", | |
"jsnext:main": "es/index.js", | |
"scripts": { | |
"build": "npm run build:lib && npm run build:es", | |
"build:lib": "BABEL_ENV=lib babel ./src --out-dir ./lib", | |
"build:es": "BABEL_ENV=es babel ./src --out-dir ./es" | |
}, | |
"dependencies": {}, | |
"devDependencies": { | |
"babel-cli": "^6.24.0", | |
"babel-core": "^6.24.0", | |
"babel-preset-env": "^1.2.2" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Located in src directory | |
function helloWorld() { | |
console.log('Hello World!'); | |
} | |
export default helloWorld(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Located in src directory | |
export helloWorld from './hello_world'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment