salix/@salix/webpack.config.js

64 lines
1.4 KiB
JavaScript

var webpack = require ('webpack');
var path = require ('path');
var devMode = process.env.NODE_ENV !== 'production';
var config = {
entry: {
'salix.app': ['app'],
'salix.login': ['login']
},
output: {
path: path.join (__dirname, '../services/nginx/static'),
filename: '[name].js',
publicPath: '/static/',
chunkFilename: "chunk.[name].[chunkhash].js"
},
module: {
loaders: [
{
test: /\.js$/,
loader: 'babel',
exclude: /node_modules/,
query: {
presets: ['es2015']
}
},{
test: /\.html$/,
loader: 'html'
},{
test: /\.json$/,
loader: 'json'
},{
test: /\.css$/,
loader: 'style!css'
},{
test: /\.scss$/,
loader: 'style!css!sass'
},{
test: /\.(svg|png)$/,
loader: 'file'
}
]
},
resolve: {
modulesDirectories: [
__dirname,
'node_modules'
]
},
devtool: 'source-map'
};
if (!devMode) {
config.plugins.push (
new webpack.optimize.UglifyJsPlugin({
minimize: true,
compress: { warnings: false }
})
);
}
module.exports = config;