-
Notifications
You must be signed in to change notification settings - Fork 2
/
craco.config.js
49 lines (48 loc) · 1.3 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
/* eslint-disable no-undef */
const { CracoAliasPlugin } = require('react-app-alias');
const CracoSwcPlugin = require('craco-swc');
module.exports = {
plugins: [
{
plugin: {
...CracoSwcPlugin,
overrideCracoConfig: ({ cracoConfig }) => {
if (typeof cracoConfig.eslint.enable !== 'undefined') {
cracoConfig.disableEslint = !cracoConfig.eslint.enable;
}
delete cracoConfig.eslint;
return cracoConfig;
},
overrideWebpackConfig: ({ webpackConfig, cracoConfig }) => {
if (
typeof cracoConfig.disableEslint !== 'undefined' &&
cracoConfig.disableEslint === true
) {
webpackConfig.plugins = webpackConfig.plugins.filter(
(instance) => instance.constructor.name !== 'ESLintWebpackPlugin',
);
}
return webpackConfig;
},
},
options: {
swcLoaderOptions: {
jsc: {
externalHelpers: true,
target: 'es5',
parser: {
syntax: 'ecmascript',
jsx: true,
dynamicImport: true,
exportDefaultFrom: true,
},
},
},
},
},
{
plugin: CracoAliasPlugin,
options: {},
},
],
};