-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcraco.config.js
executable file
·42 lines (41 loc) · 1.09 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
const webpack = require("webpack");
module.exports = {
jest: {
configure: {
globals: {
CONFIG: true,
},
},
},
webpack: {
plugins: {
add: [
new webpack.ProvidePlugin({
Buffer: ["buffer", "Buffer"],
process: "process/browser",
}),
new webpack.IgnorePlugin({
checkResource(resource) {
return /.*\/wordlists\/(?!english).*\.json/.test(resource);
},
}),
],
remove: ["ModuleScopePlugin"],
},
configure: (webpackConfig) => {
const scopePluginIndex = webpackConfig.resolve.plugins.findIndex(
({ constructor }) =>
constructor && constructor.name === "ModuleScopePlugin"
);
webpackConfig.resolve.plugins.splice(scopePluginIndex, 1);
webpackConfig.resolve.fallback = {
buffer: require.resolve("buffer"),
path: require.resolve("path-browserify"),
crypto: require.resolve("crypto-browserify"),
stream: require.resolve("stream-browserify"),
fs: false,
};
return webpackConfig;
},
},
};