Skip to content

Commit dda80df

Browse files
committed
refactor: update rollup and webpack config
1 parent d55ba43 commit dda80df

File tree

2 files changed

+23
-32
lines changed

2 files changed

+23
-32
lines changed

rollup.config.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
export default {
1+
module.exports = {
22
input: 'src/index.js',
33
output: {
44
file: 'build/vue-html-to-paper.js',
55
name: 'VueHtmlToPaper',
6-
format: 'umd'
7-
}
6+
format: 'umd',
7+
},
88
};

webpack.config.js

+20-29
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,45 @@
1-
const path = require('path');
2-
const webpack = require('webpack');
1+
var path = require('path');
2+
var TerserPlugin = require('terser-webpack-plugin');
33
var CompressionPlugin = require('compression-webpack-plugin');
44

55
module.exports = {
6+
mode: 'production',
67
entry: './src/index.js',
78
output: {
89
library: 'VueHtmlToPaper',
910
libraryTarget: 'commonjs2',
1011
path: path.resolve(__dirname, 'dist'),
11-
filename: 'index.js'
12+
filename: 'index.js',
1213
},
1314
module: {
1415
rules: [
1516
{
1617
test: /\.css$/,
17-
loader: 'style-loader!css-loader!'
18+
use: ['style-loader', 'css-loader'],
1819
},
1920
{
20-
test: /\.js$/,
21-
exclude: /(node_modules)/,
21+
test: /\.m?js$/,
22+
exclude: /(node_modules|bower_components)/,
2223
use: {
2324
loader: 'babel-loader',
2425
options: {
25-
presets: ['env']
26-
}
27-
}
28-
}
29-
]
26+
presets: ['@babel/preset-env'],
27+
},
28+
},
29+
},
30+
],
3031
},
3132
plugins: [
32-
new webpack.optimize.UglifyJsPlugin({
33-
mangle: true,
34-
compress: {
35-
warnings: false, // Suppress uglification warnings
36-
pure_getters: true,
37-
unsafe: true,
38-
unsafe_comps: true,
39-
screw_ie8: true
40-
},
41-
output: {
42-
comments: false,
43-
},
44-
exclude: [/\.min\.js$/gi] // skip pre-minified libs
45-
}),
4633
new CompressionPlugin({
4734
asset: "[path].gz[query]",
4835
algorithm: "gzip",
4936
test: /\.js$|\.css$|\.html$/,
5037
threshold: 10240,
51-
minRatio: 0
52-
})
53-
]
54-
}
38+
minRatio: 0,
39+
}),
40+
],
41+
optimization: {
42+
minimize: true,
43+
minimizer: [new TerserPlugin()],
44+
},
45+
};

0 commit comments

Comments
 (0)