-
Notifications
You must be signed in to change notification settings - Fork 182
/
craco.config.js
37 lines (34 loc) · 929 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
36
37
const path = require('path')
const CracoLessPlugin = require('craco-less')
module.exports = {
webpack: {
configure: (config, {env, paths}) => {
if (env === 'production') {
config.devtool = false
}
console.log('env:', env)
// 修改 build 输出,双 package.json 必须的改动
paths.appBuild = path.join(paths.appPath, 'app', 'build')
config.output.path = paths.appBuild
// 自定义入口
paths.appIndexJs = path.join(paths.appSrc, 'renderer', 'index.tsx')
config.entry = paths.appIndexJs
// 修改打包类型
config.target = 'electron-renderer'
return config
},
},
plugins: [
{
plugin: CracoLessPlugin,
options: {
lessLoaderOptions: {
lessOptions: {
// modifyVars: {'@primary-color': '#1DA57A'},
javascriptEnabled: true,
},
},
},
},
],
}