iview/build/webpack.dist.prod.config.js

48 lines
1.2 KiB
JavaScript
Raw Normal View History

2017-09-29 09:45:50 +02:00
const path = require('path');
const webpack = require('webpack');
const merge = require('webpack-merge');
const webpackBaseConfig = require('./webpack.base.config.js');
const CompressionPlugin = require('compression-webpack-plugin');
2016-11-03 17:21:04 +08:00
2017-03-10 21:57:50 +08:00
process.env.NODE_ENV = 'production';
module.exports = merge(webpackBaseConfig, {
2016-11-03 17:21:04 +08:00
entry: {
main: './src/index.js'
},
output: {
path: path.resolve(__dirname, '../dist'),
publicPath: '/dist/',
filename: 'iview.min.js',
library: 'iview',
libraryTarget: 'umd',
umdNamedDefine: true
},
2016-11-09 18:23:17 +08:00
externals: {
2016-11-17 16:28:36 +08:00
vue: {
root: 'Vue',
commonjs: 'vue',
commonjs2: 'vue',
amd: 'vue'
}
2016-11-09 18:23:17 +08:00
},
2016-11-03 17:21:04 +08:00
plugins: [
2017-03-10 21:57:50 +08:00
// @todo
2016-11-03 17:21:04 +08:00
new webpack.DefinePlugin({
'process.env.NODE_ENV': '"production"'
2016-11-03 17:21:04 +08:00
}),
new webpack.optimize.UglifyJsPlugin({
compress: {
warnings: false
}
2017-09-29 09:43:08 +02:00
}),
new CompressionPlugin({
asset: '[path].gz[query]',
algorithm: 'gzip',
test: /\.(js|css)$/,
threshold: 10240,
minRatio: 0.8
})
2016-11-03 17:21:04 +08:00
]
});