Skip to content

Instantly share code, notes, and snippets.

@cdaringe
Created July 23, 2015 22:12
Show Gist options
  • Save cdaringe/ee17b19edce4d58bde33 to your computer and use it in GitHub Desktop.
Save cdaringe/ee17b19edce4d58bde33 to your computer and use it in GitHub Desktop.
test-coins-webpack-config
var webpack = require('webpack');
var CommonsChunkPlugin = webpack.optimize.CommonsChunkPlugin;
var UglifyJsPlugin = webpack.optimize.UglifyJsPlugin;
var _ = require('lodash');
var path = require('path');
var isDev = process.env.COINS_ENV === 'development';
var port = process.env.WEBPACK_DEV_SERVER_PORT || 22222;
var host = '0.0.0.0';
module.exports = {
node: {
fs: "empty"
},
entry: {
tracker: './ampersand/app.js',
main: './global-utils.js'
},
output: {
path: path.join(__dirname + '/build', 'js'),
publicPath: '/',
filename: '[name].bundle.js', // one for each `entry`
chunkFilename: "[id].chunk.js"
},
plugins: [
new CommonsChunkPlugin('global.bundle.js', ['tracker', 'main']),
].concat(isDev ? [
new webpack.HotModuleReplacementPlugin()
] : [
new webpack.optimize.UglifyJsPlugin({
sourceMap: false,
compress: {
warnings: false
}
})
]),
module: {
loaders: []
}
};
module.exports.entry.devClient = 'webpack-dev-server/client?https://' + host + ':' + port;
module.exports.entry.devServer = 'webpack/hot/only-dev-server';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment