-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathwebpack.config.prod.js
More file actions
74 lines (64 loc) · 2.1 KB
/
webpack.config.prod.js
File metadata and controls
74 lines (64 loc) · 2.1 KB
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
const merge = require("webpack-merge");
const webpack = require("webpack");
const path = require("path");
const pkg = require('./package.json');
const args = process.argv.slice(2);
const baseConfig = require("./node_modules/@mendix/pluggable-widgets-tools/configs/webpack.config.prod.js");
const TerserPlugin = require("terser-webpack-plugin");
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
const customConfig = {
// Custom configuration goes here
devtool: false,
optimization: {
minimizer: [
new TerserPlugin({
cache: true,
parallel: true,
extractComments: false,
terserOptions: {
ecma: undefined,
warnings: false,
sourceMap: false,
parse: {},
compress: {
passes: 2
},
mangle: true,
module: false,
output: {
comments: false,
beautify: false,
preamble: `/* Text Template Widget || Version ${pkg.version} || Apache 2 LICENSE || Developer: ${pkg.author} || Please report any issues here: https://github.com/JelteMX/mendix-text-template/issues */\n`
},
toplevel: false,
nameCache: null,
ie8: false,
keep_classnames: undefined,
keep_fnames: false,
safari10: false
},
}),
]
},
plugins: [
],
// We add this to further slim down the package
resolve: {
alias: {
}
}
};
if (args.includes("--analyze")) {
customConfig.plugins.push(new BundleAnalyzerPlugin());
}
const previewConfig = {
// Custom configuration goes here
// devtool: "source-map"
plugins: [
],
resolve: {
alias: {
}
}
};
module.exports = [merge(baseConfig[0], customConfig), merge(baseConfig[1], previewConfig)];