2016-09-29 05:10:58 +00:00
|
|
|
|
2016-11-11 11:04:50 +00:00
|
|
|
var webpack = require ('webpack');
|
2016-11-09 11:42:37 +00:00
|
|
|
var path = require ('path');
|
2016-09-29 05:10:58 +00:00
|
|
|
|
2016-11-18 13:12:57 +00:00
|
|
|
var devMode = process.env.NODE_ENV !== 'production';
|
|
|
|
|
|
|
|
var config = {
|
2016-10-07 08:13:03 +00:00
|
|
|
entry: {
|
2016-11-04 10:32:27 +00:00
|
|
|
'salix.app': ['app'],
|
|
|
|
'salix.login': ['login']
|
2016-10-07 08:13:03 +00:00
|
|
|
},
|
|
|
|
output: {
|
2016-11-18 13:12:57 +00:00
|
|
|
path: path.join (__dirname, '../services/nginx/static'),
|
2016-10-07 08:13:03 +00:00
|
|
|
filename: '[name].js',
|
2016-11-09 12:10:56 +00:00
|
|
|
publicPath: '/static/',
|
2016-11-09 17:10:33 +00:00
|
|
|
chunkFilename: "chunk.[name].[chunkhash].js"
|
2016-10-07 08:13:03 +00:00
|
|
|
},
|
|
|
|
module: {
|
|
|
|
loaders: [
|
|
|
|
{
|
|
|
|
test: /\.js$/,
|
|
|
|
loader: 'babel',
|
|
|
|
exclude: /node_modules/,
|
|
|
|
query: {
|
|
|
|
presets: ['es2015']
|
|
|
|
}
|
2016-11-03 14:36:33 +00:00
|
|
|
},{
|
2016-10-07 08:13:03 +00:00
|
|
|
test: /\.html$/,
|
2016-11-29 15:55:10 +00:00
|
|
|
loader: 'html'
|
2016-11-03 14:36:33 +00:00
|
|
|
},{
|
2016-10-07 08:13:03 +00:00
|
|
|
test: /\.json$/,
|
|
|
|
loader: 'json'
|
2016-11-03 14:36:33 +00:00
|
|
|
},{
|
2016-10-07 08:13:03 +00:00
|
|
|
test: /\.css$/,
|
|
|
|
loader: 'style!css'
|
2016-11-03 14:36:33 +00:00
|
|
|
},{
|
|
|
|
test: /\.scss$/,
|
|
|
|
loader: 'style!css!sass'
|
2016-11-29 15:55:10 +00:00
|
|
|
},{
|
2017-01-04 13:22:30 +00:00
|
|
|
test: /\.(svg|png|ttf)$/,
|
2016-11-29 15:55:10 +00:00
|
|
|
loader: 'file'
|
2016-10-07 08:13:03 +00:00
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
2016-11-18 13:12:57 +00:00
|
|
|
resolve: {
|
2016-10-07 08:13:03 +00:00
|
|
|
modulesDirectories: [
|
|
|
|
__dirname,
|
|
|
|
'node_modules'
|
|
|
|
]
|
2016-10-07 10:08:26 +00:00
|
|
|
},
|
2016-12-07 13:59:21 +00:00
|
|
|
plugins: [],
|
2016-12-15 07:31:15 +00:00
|
|
|
devtool: 'source-map'
|
2016-09-29 05:10:58 +00:00
|
|
|
};
|
2016-11-09 11:42:37 +00:00
|
|
|
|
2016-12-15 07:31:15 +00:00
|
|
|
if (!devMode) {
|
2016-11-18 13:12:57 +00:00
|
|
|
config.plugins.push (
|
2016-11-23 16:25:19 +00:00
|
|
|
new webpack.optimize.UglifyJsPlugin({
|
2016-11-18 13:12:57 +00:00
|
|
|
minimize: true,
|
|
|
|
compress: { warnings: false }
|
|
|
|
})
|
|
|
|
);
|
2016-12-15 07:31:15 +00:00
|
|
|
}
|
2016-11-18 13:12:57 +00:00
|
|
|
|
|
|
|
module.exports = config;
|