-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcraco.config.js
62 lines (61 loc) · 1.37 KB
/
craco.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
const path = require('path');
const TerserPlugin = require("terser-webpack-plugin");
const CracoCSSModules = require('craco-css-modules');
module.exports = {
webpack: {
alias: {
'@': path.resolve(__dirname, "src")
},
performance: {
hints: 'error',
maxAssetSize: 300000000, // 整数类型(以字节为单位)
maxEntrypointSize: 500000000 // 整数类型(以字节为单位)
},
sourcemap: false,
// 更改build打包文件名称为dist
configure: (webpackConfig, { env, paths }) => {
if (env === "production") {
webpackConfig.devtool = false;
}
webpackConfig.output.path = path.resolve(__dirname, 'dist')
paths.appBuild = path.resolve(__dirname, 'dist')
webpackConfig.optimization.minimizer = [
new TerserPlugin({
terserOptions: {
ecma: undefined,
warnings: false,
parse: {},
compress: {},
mangle: true,
module: false,
output: null,
toplevel: false,
nameCache: null,
ie8: false,
keep_classnames: undefined,
keep_fnames: false,
safari10: false,
},
}),
];
return webpackConfig
},
},
paths: {
appSrc: path.resolve(__dirname, "src")
},
devServer: {
host: '0.0.0.0',
port: 8001,
open: false,
proxy: {
"/api": {
target: "http://localhost:8005",
changeOrigin: true
}
}
},
plugins: [
{plugin: CracoCSSModules}
]
};