2017-06-25 20:13:39 +02:00
|
|
|
import webpack from 'webpack';
|
|
|
|
import HTMLWebpackPlugin from 'html-webpack-plugin';
|
|
|
|
import ExtractTextPlugin from 'extract-text-webpack-plugin';
|
2017-07-13 23:28:45 +02:00
|
|
|
import baseConfig from './webpack.config';
|
|
|
|
import env from '../../config/env';
|
|
|
|
import _ from 'lodash';
|
2017-06-25 20:13:39 +02:00
|
|
|
|
|
|
|
baseConfig.module.rules
|
2017-07-13 23:28:45 +02:00
|
|
|
.filter((loader) =>
|
|
|
|
Array.isArray(loader.use) && loader.use.find((v) => /css/.test(v.loader.split('-')[0]))
|
|
|
|
).forEach((loader) => {
|
2017-06-25 20:13:39 +02:00
|
|
|
loader.use = ExtractTextPlugin.extract({
|
|
|
|
fallback: 'style-loader',
|
|
|
|
use: _.tail(loader.use)
|
2017-07-13 23:28:45 +02:00
|
|
|
});
|
|
|
|
});
|
2017-06-25 20:13:39 +02:00
|
|
|
|
|
|
|
export default {
|
|
|
|
...baseConfig,
|
|
|
|
entry: {
|
2017-07-13 23:28:45 +02:00
|
|
|
main: `${env.SRC_ROOT}/webui/src/index.js`
|
2017-06-25 20:13:39 +02:00
|
|
|
},
|
|
|
|
|
|
|
|
output: {
|
2017-07-09 19:32:09 +02:00
|
|
|
...baseConfig.output
|
2017-06-25 20:13:39 +02:00
|
|
|
},
|
|
|
|
|
|
|
|
plugins: [
|
|
|
|
new webpack.DefinePlugin({
|
2017-07-13 23:28:45 +02:00
|
|
|
'__DEBUG__': false,
|
2017-06-25 20:13:39 +02:00
|
|
|
'process.env.NODE_ENV': '"production"'
|
|
|
|
}),
|
|
|
|
new webpack.optimize.UglifyJsPlugin({
|
|
|
|
sourceMap: true,
|
|
|
|
compress: {
|
|
|
|
warnings: false
|
|
|
|
}
|
|
|
|
}),
|
|
|
|
new ExtractTextPlugin('style.[contenthash].css'),
|
|
|
|
new HTMLWebpackPlugin({
|
|
|
|
title: 'Verdaccio',
|
|
|
|
filename: 'index.html',
|
|
|
|
verdaccioURL: 'ToReplaceByVerdaccio',
|
2017-07-13 19:55:19 +02:00
|
|
|
template: `${env.SRC_ROOT}/webui/template/index.html`,
|
2017-07-06 16:42:36 +02:00
|
|
|
debug: false,
|
2017-06-25 20:13:39 +02:00
|
|
|
inject: true,
|
|
|
|
}),
|
|
|
|
new webpack.NoEmitOnErrorsPlugin()
|
|
|
|
]
|
2017-07-13 23:28:45 +02:00
|
|
|
};
|