-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.vendor.config.js
55 lines (49 loc) · 1.3 KB
/
webpack.vendor.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
/**
* @author MrZenW
* @email [email protected], https://MrZenW.com
* @create date 2021-05-25 13:22:11
* @modify date 2021-08-27 14:54:31
* @desc [description]
*/
/* eslint-disable import/no-extraneous-dependencies */
const { join, resolve } = require('path');
const webpack = require('webpack');
const CompressionPlugin = require('compression-webpack-plugin');
const { merge } = require('webpack-merge');
const rules = require('./webpack.rules');
const { APP_PUBLIC_BIN_DIR } = process.env;
module.exports = merge({}, rules, {
mode: 'production',
entry: {
vendor: [
'statecore',
'bootstrap',
'jquery',
'react',
'react-dom',
'lodash',
'sweetalert2',
// 'mqtt',
],
},
output: {
path: resolve(__dirname, 'dist', APP_PUBLIC_BIN_DIR),
filename: 'mrzenwdotcom-vendor-[fullhash].bundle.js',
chunkFilename: 'mrzenwdotcom-vendor-[fullhash].js',
library: '[name]',
},
plugins: [
new webpack.DllPlugin({
context: __dirname,
name: '[name]',
path: join(__dirname, 'dist', APP_PUBLIC_BIN_DIR, 'mrzenwdotcom-vendor-manifest.json'),
}),
new CompressionPlugin({
filename: '[path][base].gz[query]',
algorithm: 'gzip',
test: /\.(js|html)$/i,
threshold: 10240,
minRatio: 0.8,
}),
],
});