-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig-overrides.js
35 lines (33 loc) · 1.18 KB
/
config-overrides.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
/* eslint-disable no-param-reassign */
const path = require("path");
const fs = require("fs");
const {override, addLessLoader, addWebpackAlias} = require("customize-cra");
// const { aliasDangerous, configPaths } = require('react-app-rewire-alias/lib/aliasDangerous');
// const processDefine = Object.entries(process.env).reduce(
// (res, [key, value]) => ({
// ...res,
// [`process.env.${key}`]: JSON.stringify(value),
// }),
// {},
// );
console.log(process.env);
module.exports = {
webpack: override(
// removeModuleScopePlugin(), // 为了导入根目录的common,cra默认只能导入src下的文件
addWebpackAlias({
"@": path.resolve(__dirname, "./src"),
}),
addLessLoader({
lessOptions: {
javascriptEnabled: true,
// Optionally adjust URLs to be relative. When false, URLs are already relative to the entry less file.
relativeUrls: false,
// modifyVars: { '@primary-color': '#A80000' },
cssModules: {
// if you use CSS Modules, and custom `localIdentName`, default is '[local]--[hash:base64:5]'.
localIdentName: "[path][name]__[local]--[hash:base64:5]",
},
},
}),
),
};