Created
August 27, 2016 19:22
-
-
Save Fake51/97d5698cd023d88b56677cd073b36757 to your computer and use it in GitHub Desktop.
deploy
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
# usage | |
npm run compile | |
# package.json | |
{ | |
"devDependencies": { | |
"babel-core": "^6.14.0", | |
"babel-loader": "^6.2.5", | |
"babel-plugin-transform-runtime": "^6.12.0", | |
"babel-preset-es2015": "^6.14.0", | |
"webpack": "^1.13.2" | |
}, | |
"scripts": { | |
"compile": "babel -d lib/ src/" | |
}, | |
"dependencies": { | |
"babel-polyfill": "^6.13.0", | |
"babel-runtime": "^6.11.6" | |
} | |
} | |
# webpack.config.js | |
var path = require('path'), | |
webpack = require('webpack'); | |
module.exports = { | |
module: { | |
loaders: [ | |
{ | |
loader: "babel-loader", | |
// Skip any files outside of your project's `src` directory | |
include: [ | |
path.resolve(__dirname, "src"), | |
], | |
// Only run `.js` files through Babel | |
test: /\.js$/, | |
// Options to configure babel with | |
query: { | |
plugins: ['transform-runtime'], | |
} | |
}, | |
], | |
}, | |
entry: [ | |
'babel-polyfill', | |
'./src/lib' | |
], | |
devtool: "source-map", | |
plugins: [ | |
new webpack.optimize.UglifyJsPlugin({compress: {warnings: false}}), | |
], | |
output: { | |
publicPath: '/', | |
filename: './dest/lib.js' | |
} | |
}; | |
# .babelrc | |
{ | |
"presets": ["es2015"] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment