-
Notifications
You must be signed in to change notification settings - Fork 5
/
craco.config.js
33 lines (30 loc) · 1.15 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
const path = require('path');
module.exports = {
webpack: {
configure: webpackConfig => {
const scopePluginIndex = webpackConfig.resolve.plugins.findIndex(
({ constructor }) => constructor && constructor.name === 'ModuleScopePlugin',
)
webpackConfig.resolve.plugins.splice(scopePluginIndex, 1)
const config = {
...webpackConfig,
/* Any webpack configuration options: https://webpack.js.org/configuration */
/* Webpack <5 used to add polyfills for node.js core modules by default */
resolve: {
modules: [ path.resolve(process.env.PWD, 'src'), 'node_modules' ],
extensions: [ '.js', '.jsx', '.ts', '.tsx' ],
fallback: {
path: require.resolve('path-browserify'),
fs: false
},
alias: {
fs: path.resolve(process.env.PWD, 'src/mock-fs.js'),
process: 'process/browser',
},
mainFields: [ 'browser', 'module', 'main' ],
},
}
return config
},
},
}