UMD webpack build setup

This commit is contained in:
Leon Chen
2016-08-21 21:36:07 -04:00
parent a7a217fd1d
commit 623e05debb
2 changed files with 67 additions and 0 deletions
+33
View File
@@ -0,0 +1,33 @@
const webpack = require('webpack')
module.exports = {
devtool: 'cheap-module-eval-source-map',
module: {
loaders: [
{
test: /\.js$/,
loaders: ['babel-loader'],
exclude: /node_modules/
}
]
},
output: {
library: 'KerasJS',
libraryTarget: 'umd'
},
resolve: {
extensions: ['', '.js']
},
plugins: [
new webpack.optimize.OccurenceOrderPlugin(),
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify('production')
}),
new webpack.optimize.UglifyJsPlugin({
compressor: {
screw_ie8: true,
warnings: false
}
})
]
}
+34
View File
@@ -0,0 +1,34 @@
const webpack = require('webpack')
module.exports = {
module: {
loaders: [
{
test: /\.js$/,
loaders: ['babel-loader'],
exclude: /node_modules/
}
]
},
output: {
library: 'KerasJS',
libraryTarget: 'umd'
},
resolve: {
extensions: ['', '.js']
},
plugins: [
new webpack.DefinePlugin({
'process.env': {
NODE_ENV: JSON.stringify('production')
}
}),
new webpack.optimize.DedupePlugin(),
new webpack.optimize.OccurenceOrderPlugin(),
new webpack.optimize.UglifyJsPlugin({
compress: {
warnings: false
}
})
]
}