2017-01-31 13:13:06 +00:00
|
|
|
|
|
|
|
var webpack = require('webpack');
|
|
|
|
var path = require('path');
|
|
|
|
|
|
|
|
var devMode = process.env.NODE_ENV !== 'production';
|
|
|
|
|
|
|
|
var config = {
|
|
|
|
entry: {
|
|
|
|
'bundle.salix': ['salix'],
|
|
|
|
'bundle.auth': ['auth'],
|
2017-05-16 10:37:48 +00:00
|
|
|
'bundle.vendor': ['vendor']
|
2017-01-31 13:13:06 +00:00
|
|
|
},
|
|
|
|
output: {
|
2017-05-16 10:37:48 +00:00
|
|
|
path: path.join(__dirname, './services/nginx/static'),
|
2017-01-31 13:13:06 +00:00
|
|
|
filename: '[name].js',
|
|
|
|
publicPath: '/static/',
|
|
|
|
chunkFilename: 'chunk.[name].[chunkhash].js'
|
|
|
|
},
|
|
|
|
module: {
|
|
|
|
loaders: [
|
|
|
|
{
|
|
|
|
test: /\.js$/,
|
|
|
|
loader: 'babel-loader',
|
|
|
|
exclude: /node_modules/,
|
|
|
|
query: {
|
|
|
|
presets: ['es2015']
|
|
|
|
}
|
2018-02-04 18:39:56 +00:00
|
|
|
}, {
|
|
|
|
test: /\.yml$/,
|
|
|
|
loader: 'json-loader!yaml-loader'
|
|
|
|
}, {
|
2017-01-31 13:13:06 +00:00
|
|
|
test: /\.html$/,
|
|
|
|
loader: 'html-loader'
|
2018-02-04 18:39:56 +00:00
|
|
|
}, {
|
2017-01-31 13:13:06 +00:00
|
|
|
test: /\.css$/,
|
|
|
|
loader: 'style-loader!css-loader'
|
2018-02-04 18:39:56 +00:00
|
|
|
}, {
|
2017-01-31 13:13:06 +00:00
|
|
|
test: /\.scss$/,
|
|
|
|
loader: 'style-loader!css-loader!sass-loader'
|
2018-02-04 18:39:56 +00:00
|
|
|
}, {
|
2017-02-21 11:49:41 +00:00
|
|
|
test: /\.(svg|png|ttf|woff|woff2)$/,
|
2017-01-31 13:13:06 +00:00
|
|
|
loader: 'file-loader'
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
resolve: {
|
|
|
|
modules: [
|
|
|
|
path.join(__dirname, 'client'),
|
|
|
|
__dirname,
|
2017-01-31 14:58:28 +00:00
|
|
|
'node_modules',
|
2017-05-16 10:37:48 +00:00
|
|
|
'/usr/lib/node_modules'
|
2017-01-31 13:13:06 +00:00
|
|
|
]
|
|
|
|
},
|
|
|
|
plugins: [
|
2017-05-16 10:37:48 +00:00
|
|
|
new webpack.optimize.CommonsChunkPlugin({
|
2017-09-21 13:02:46 +00:00
|
|
|
names: ['bundle.vendor', 'bundle.manifest']
|
2017-05-16 10:37:48 +00:00
|
|
|
})
|
2017-01-31 13:13:06 +00:00
|
|
|
],
|
2017-06-05 07:01:21 +00:00
|
|
|
devtool: 'source-map'
|
2017-01-31 13:13:06 +00:00
|
|
|
};
|
2018-01-29 11:37:54 +00:00
|
|
|
|
|
|
|
if (!devMode) {
|
|
|
|
// FIXME: https://github.com/webpack-contrib/uglifyjs-webpack-plugin/issues/132
|
|
|
|
// config.plugins.push(
|
|
|
|
// new webpack.optimize.UglifyJsPlugin({
|
|
|
|
// minimize: true,
|
|
|
|
// compress: {warnings: false}
|
|
|
|
// })
|
|
|
|
// );
|
|
|
|
}
|
2017-01-31 13:13:06 +00:00
|
|
|
|
|
|
|
module.exports = config;
|