salix/@salix/webpack.config.js

65 lines
1.3 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: 'raw'
},{
test: /\.json$/,
loader: 'json'
},{
test: /\.css$/,
loader: 'style!css'
},{
test: /\.scss$/,
loader: 'style!css!sass'
}
]
},
resolve: {
modulesDirectories: [
__dirname,
'node_modules'
]
},
devServer: {
inline: true,
host: '0.0.0.0'
},
devtool: 'source-map'
};
if (!devMode) {
config.plugins.push (
new webpack.optimize.UglifyJsPlugin ({
minimize: true,
compress: { warnings: false }
})
);
}
module.exports = config;