salix/@salix/webpack.config.js

65 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|ttf)$/,
loader: 'file'
}
]
},
resolve: {
modulesDirectories: [
__dirname,
'node_modules'
]
},
plugins: [],
devtool: 'source-map'
};
if (!devMode) {
config.plugins.push (
new webpack.optimize.UglifyJsPlugin({
minimize: true,
compress: { warnings: false }
})
);
}
module.exports = config;