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';
|
2017-03-03 22:38:40 +08:00
|
|
|
|
|
|
|
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({
|
2017-03-27 11:47:57 +08:00
|
|
|
'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
|
2017-03-01 12:00:31 +08:00
|
|
|
})
|
2016-11-03 17:21:04 +08:00
|
|
|
]
|
2017-03-03 22:38:40 +08:00
|
|
|
});
|