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'],
|
|
|
|
'bundle.vendor': ['vendor']
|
|
|
|
},
|
|
|
|
output: {
|
|
|
|
path: path.join (__dirname, './services/nginx/static'),
|
|
|
|
filename: '[name].js',
|
|
|
|
publicPath: '/static/',
|
|
|
|
chunkFilename: 'chunk.[name].[chunkhash].js'
|
|
|
|
},
|
|
|
|
module: {
|
|
|
|
loaders: [
|
|
|
|
{
|
|
|
|
test: /\.js$/,
|
|
|
|
loader: 'babel-loader',
|
|
|
|
exclude: /node_modules/,
|
|
|
|
query: {
|
|
|
|
presets: ['es2015']
|
|
|
|
}
|
2017-02-21 11:49:41 +00:00
|
|
|
},
|
|
|
|
{
|
2017-01-31 13:13:06 +00:00
|
|
|
test: /\.html$/,
|
|
|
|
loader: 'html-loader'
|
2017-02-21 11:49:41 +00:00
|
|
|
},
|
|
|
|
{
|
2017-01-31 13:13:06 +00:00
|
|
|
test: /\.css$/,
|
|
|
|
loader: 'style-loader!css-loader'
|
2017-02-21 11:49:41 +00:00
|
|
|
},
|
|
|
|
{
|
2017-01-31 13:13:06 +00:00
|
|
|
test: /\.scss$/,
|
|
|
|
loader: 'style-loader!css-loader!sass-loader'
|
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',
|
|
|
|
'/usr/lib/node_modules'
|
2017-01-31 13:13:06 +00:00
|
|
|
]
|
|
|
|
},
|
|
|
|
plugins: [
|
|
|
|
new webpack.optimize.CommonsChunkPlugin({
|
|
|
|
names: ['bundle.vendor', 'bundle.manifest']
|
|
|
|
})
|
|
|
|
],
|
|
|
|
devtool: 'source-map'
|
|
|
|
};
|
|
|
|
|
2017-02-21 11:49:41 +00:00
|
|
|
if (!devMode) {
|
|
|
|
config.plugins.push (
|
2017-01-31 13:13:06 +00:00
|
|
|
new webpack.optimize.UglifyJsPlugin({
|
2017-02-21 11:49:41 +00:00
|
|
|
minimize: true,
|
|
|
|
compress: { warnings: false }
|
2017-01-31 13:13:06 +00:00
|
|
|
})
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = config;
|