-
Notifications
You must be signed in to change notification settings - Fork 0
/
craco.config.js
35 lines (33 loc) · 955 Bytes
/
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
const path = require('path')
const resolve = dir => path.resolve(__dirname, dir)
const TerserPlugin = require('terser-webpack-plugin')
module.exports = {
webpack: {
alias: {
"@": resolve("src"),
"components": resolve("src/components"),
"pages": resolve("src/pages"),
"api": resolve("src/api"),
"utils": resolve("src/utils")
},
plugins: [
new TerserPlugin({
terserOptions: {
compress: {
drop_console: process.env.NODE_ENV === 'production'
// 生产环境下移除控制台所有的内容
}
}
})
],
configure: (webpackConfig, { env, paths }) => {
paths.appBuild = 'dist/react-admin';
webpackConfig.output = {
...webpackConfig.output,
path: path.resolve(__dirname, 'dist/react-admin'),
publicPath: process.env.NODE_ENV === 'production' ? './' : '/'
}
return webpackConfig;
}
}
}