2
0
mirror of https://github.com/tenrok/vue-json-viewer.git synced 2026-06-23 20:40:38 +03:00

upgrade to webpack 4

This commit is contained in:
陈峰
2019-03-16 21:48:03 +08:00
parent 147e0dc3e0
commit 0283c883d8
4 changed files with 1131 additions and 740 deletions
+25 -13
View File
@@ -1,9 +1,26 @@
const path = require('path');
const webpack = require('webpack')
const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
const VueLoaderPlugin = require('vue-loader/lib/plugin');
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
module.exports = {
mode: 'production',
entry: './lib/index.js',
optimization: {
minimizer: [
new UglifyJsPlugin({
cache: true,
parallel: true,
sourceMap: true,
uglifyOptions: {
compress: {
warnings: false
},
comments: false
}
}),
],
},
output: {
path: path.join(__dirname, '../dist'),
filename: 'vue-json-viewer.js',
@@ -27,8 +44,8 @@ module.exports = {
exclude: /node_modules/
},
{
test: /\.css$/,
use: ['vue-style-loader', 'css-loader', 'autoprefixer-loader']
test: /\.s?css$/,
use: ['vue-style-loader', 'css-loader', 'postcss-loader', 'sass-loader']
},
{
test: /\.(png|jpe?g|gif|svg)(\?.*)?$/,
@@ -55,15 +72,10 @@ module.exports = {
]
},
plugins: [
new webpack.optimize.UglifyJsPlugin({
parallel: true,
uglifyOptions: {
compress: {
warnings: false
},
comments: false
}
}),
// new BundleAnalyzerPlugin()
new VueLoaderPlugin()
]
}
if (process.argv.some(a => a === '--report')) {
module.exports.plugins.push(new BundleAnalyzerPlugin());
}