-
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathwebpack.production.config.js
88 lines (87 loc) · 2.87 KB
/
webpack.production.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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
import path from 'path';
import CssMinimizerPlugin from 'css-minimizer-webpack-plugin';
import MiniCssExtractPlugin from 'mini-css-extract-plugin';
import TerserPlugin from "terser-webpack-plugin";
import webpack from 'webpack';
import ReplaceHashPlugin from './ReplaceHashPlugin.js';
export default {
mode: 'production',
entry: {
im: {
import: ['./loader/production/im.bundle.js', './src/Client/css/im.css'],
dependOn: 'emoji'
},
login: './loader/production/login.bundle.js',
profile: {
import: ['./loader/production/profile.bundle.js', './src/Client/css/profile.css'],
dependOn: 'im'
},
karmaPrivileges: {
import: ['./loader/production/karmaPrivileges.bundle.js', './src/Client/css/karmaPrivileges.css'],
dependOn: 'im'
},
help: ['./loader/production/help.bundle.js', './src/Client/css/help.css'],
internalHelp: {
import: './loader/production/internalHelp.bundle.js',
dependOn: 'im'
},
settings: {
import: ['./loader/production/settings.bundle.js', './src/Client/css/settings.css'],
dependOn: 'im'
},
experiments: {
import: ['./loader/production/experiments.bundle.js', './src/Client/css/experiments.css'],
dependOn: 'im'
},
feedback: {
import: ['./loader/production/feedback.bundle.js', './src/Client/css/feedback.css'],
dependOn: 'im'
},
recover: './loader/production/recover.bundle.js',
emoji: './output-es/Shared.Im.Emoji/index.js',
base: './src/Client/css/base.css',
external: './src/Client/css/external.css',
backer: './src/Client/css/backer.css'
},
output: {
path: path.resolve(".", 'file/bundle'),
filename: '[name].[contenthash].bundle.js'
},
plugins: [
new MiniCssExtractPlugin({
filename: '[name].[contenthash].css',
}),
new webpack.DefinePlugin({
'process.env.PRODUCTION': true
}),
new ReplaceHashPlugin({ files: [{ dir: 'file/bundle', prefix: 'common' }, 'output-es/Shared.Resource/index.js'] }),
],
module: {
rules: [
{
test: /\.css$/,
use: [
MiniCssExtractPlugin.loader,
{
loader: 'css-loader',
options: {
url: false,
}
}
]
}
]
},
optimization: {
removeEmptyChunks: true,
moduleIds: 'deterministic',
splitChunks: {
chunks: 'all',
name: 'common'
},
minimizer: [
new TerserPlugin(),
new CssMinimizerPlugin(),
]
},
};