salix/webpack.config.js

72 lines
1.8 KiB
JavaScript

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: {
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'
}, {
test: /\.(svg|png|ttf|woff|woff2)$/,
loader: 'file-loader'
}
]
},
resolve: {
modules: [
`${__dirname}/client`,
__dirname,
'node_modules'
]
},
plugins: [
new webpack.optimize.CommonsChunkPlugin({
names: ['bundle.vendor', 'bundle.manifest']
})
],
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;