0
Fork 0
mirror of https://github.com/verdaccio/verdaccio.git synced 2024-12-16 21:56:25 -05:00
verdaccio/src/webui/scripts/webpack.prod.config.babel.js

51 lines
1.2 KiB
JavaScript
Raw Normal View History

import webpack from 'webpack';
import HTMLWebpackPlugin from 'html-webpack-plugin';
import ExtractTextPlugin from 'extract-text-webpack-plugin';
import baseConfig from './webpack.config'
import env from '../../config/env'
import _ from 'lodash'
baseConfig.module.rules
.filter(loader =>
Array.isArray(loader.use) && loader.use.find(v => /css/.test(v.loader.split('-')[0]))
).forEach(loader => {
loader.use = ExtractTextPlugin.extract({
fallback: 'style-loader',
use: _.tail(loader.use)
})
})
export default {
...baseConfig,
entry: {
main: `${env.SRC_ROOT}/webui/src/index.jsx`
},
output: {
...baseConfig.output
},
plugins: [
new webpack.DefinePlugin({
__DEBUG__: false,
'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',
template: `${env.SRC_ROOT}/webui/template/index.html`,
2017-07-06 09:42:36 -05:00
debug: false,
inject: true,
}),
new webpack.NoEmitOnErrorsPlugin()
]
}