metamaps--metamaps/webpack.config.js

40 lines
810 B
JavaScript
Raw Normal View History

2016-08-11 03:42:35 +00:00
const path = require('path')
const webpack = require('webpack')
const NODE_ENV = process.env.NODE_ENV || 'development'
const plugins = [
new webpack.DefinePlugin({
"process.env.NODE_ENV": `"${NODE_ENV}"`
})
]
if (NODE_ENV === 'production') {
2016-09-25 13:53:40 +00:00
plugins.push(new webpack.optimize.DedupePlugin())
2016-08-11 03:42:35 +00:00
plugins.push(new webpack.optimize.UglifyJsPlugin({
compress: { warnings: false }
}))
}
const config = module.exports = {
context: __dirname,
2016-08-11 03:42:35 +00:00
plugins,
module: {
loaders: [
{
test: /\.(js|jsx)?$/,
exclude: /node_modules/,
loaders: [
"babel-loader?cacheDirectory"
]
}
]
},
entry: {
'metamaps.bundle': './frontend/src/index.js'
},
output: {
path: './app/assets/javascripts/webpacked',
filename: '[name].js'
}
}