salix/webpack.config.js

72 lines
1.8 KiB
JavaScript
Raw Normal View History

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']
},
output: {
2017-05-16 10:37:48 +00:00
path: path.join(__dirname, './services/nginx/static'),
filename: '[name].js',
publicPath: '/static/',
chunkFilename: 'chunk.[name].[chunkhash].js'
},
module: {
2018-02-08 12:47:54 +00:00
rules: [
{
test: /\.js$/,
loader: 'babel-loader',
exclude: /node_modules/,
query: {
presets: ['es2015']
}
}, {
test: /\.yml$/,
loader: 'json-loader!yaml-loader'
}, {
test: /\.html$/,
loader: 'html-loader'
}, {
test: /\.css$/,
loader: 'style-loader!css-loader'
}, {
test: /\.scss$/,
loader: 'style-loader!css-loader!sass-loader'
}, {
2017-02-21 11:49:41 +00:00
test: /\.(svg|png|ttf|woff|woff2)$/,
loader: 'file-loader'
}
]
},
resolve: {
modules: [
2018-02-08 12:47:54 +00:00
`${__dirname}/client`,
__dirname,
2018-02-08 12:47:54 +00:00
'node_modules'
]
},
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
})
],
devtool: 'source-map'
};
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}
// })
// );
}
module.exports = config;