-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcraco.config.js
50 lines (49 loc) · 1.17 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
const CracoLessPlugin = require("craco-less")
const CracoAlias = require("craco-alias")
const { theme } = require("./src/theme")
const path = require("path")
const isProd = process.argv.includes("--prod")
const proxyDev = isProd ? require("./proxy.prod.conf.json") : require("./proxy.config.json")
const { BundleAnalyzerPlugin } = require("webpack-bundle-analyzer")
module.exports = {
devServer: {
proxy: proxyDev
},
webpack: {
plugins: [
// new BundleAnalyzerPlugin({
// analyzerMode: 'server',
// analyzerHost: '127.0.0.1',
// analyzerPort: 8888,
// openAnalyzer: true, // 构建完打开浏览器
// reportFilename: path.resolve(__dirname, `analyzer/index.html`)
// }),
],
configure: (webpackConfig, { env, paths }) => {
paths.appBuild = webpackConfig.output.path = path.resolve("dist")
return webpackConfig
}
},
babel: {},
plugins: [
{
plugin: CracoAlias,
options: {
source: "tsconfig",
baseUrl: ".",
tsConfigPath: "./tsconfig.extend.json"
}
},
{
plugin: CracoLessPlugin,
options: {
lessLoaderOptions: {
lessOptions: {
modifyVars: theme,
javascriptEnabled: true
}
}
}
}
]
}