-
Notifications
You must be signed in to change notification settings - Fork 0
/
craco.config.js
43 lines (40 loc) · 1.06 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
const path = require(`path`);
const alias = (prefix = `src`) => ({
react: `./node_modules/react`,
"styled-components": `./node_modules/styled-components`,
"@zendeskgarden/react-theming": `./node_modules/@zendeskgarden/react-theming`,
formik: `./node_modules/formik`,
"styled-components": `./node_modules/styled-components`,
});
const SRC = `./src`;
const aliases = alias(SRC);
const resolvedAliases = Object.fromEntries(
Object.entries(aliases).map(([key, value]) => [
key,
path.resolve(__dirname, value),
])
);
module.exports = {
eslint: {
enable: false,
},
webpack: {
alias: resolvedAliases,
configure: (webpackConfig) => {
webpackConfig.module.rules.push({
test: /\.mjs$/,
include: /node_modules/,
type: "javascript/auto",
});
return webpackConfig;
},
},
babel: {
presets: ["@babel/preset-env"],
plugins: [
"@babel/plugin-proposal-optional-chaining",
"@babel/plugin-proposal-nullish-coalescing-operator",
"@babel/plugin-proposal-numeric-separator",
],
},
};