-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.pro.js
48 lines (43 loc) · 1.28 KB
/
webpack.config.pro.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
const path = require('path');
const webpack = require('webpack');
const { merge } = require('webpack-merge');
const VueLoaderPlugin = require('vue-loader/lib/plugin');
const FileManagerPlugin = require('filemanager-webpack-plugin');
const CleanWebpackPlugin = require('clean-webpack-plugin');
const commonConfig = require('./webpack.config.common.js')
const proConfig = {
mode: 'production',
entry: {
app: './src/App.js',
},
output: {
filename: 'js/[name].[contenthash].js',
path: path.resolve(__dirname, './dist')
},
optimization: {
splitChunks: {
cacheGroups: {
commons: {
chunks: 'initial',
test: /[\\/]node_modules[\\/]/,
priority: -10,
filename: 'js/common.js'
},
// default: false
}
}
},
plugins: [
new VueLoaderPlugin(),
new FileManagerPlugin({
onEnd: {
copy: [
{ source: path.resolve(__dirname, './dist/index.html'), destination: path.resolve(__dirname, './server/view/index.html')},
{ source: path.resolve(__dirname, './dist/js'), destination: path.resolve(__dirname, './server/static/js')},
]
}
}),
new CleanWebpackPlugin([path.resolve(__dirname, './dist/')])
]
};
module.exports = merge(proConfig, commonConfig)