-
Notifications
You must be signed in to change notification settings - Fork 26
/
Copy pathcraco.config.js
46 lines (41 loc) · 1.19 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
const webpack = require("webpack");
module.exports = {
webpack: {
configure: (webpackConfig) => {
const wasmExtensionRegExp = /\.wasm$/;
webpackConfig.resolve.extensions.push(".wasm");
webpackConfig.experiments = {
asyncWebAssembly: true,
topLevelAwait: true,
layers: true
};
webpackConfig.resolve.fallback = {
buffer: require.resolve("buffer/"),
stream: require.resolve("stream-browserify")
};
webpackConfig.module.rules.forEach((rule) => {
(rule.oneOf || []).forEach((oneOf) => {
if (oneOf.type === "asset/resource") {
oneOf.exclude.push(wasmExtensionRegExp);
}
});
});
webpackConfig.plugins.push(
new webpack.ProvidePlugin({
Buffer: ["buffer", "Buffer"]
})
);
webpackConfig.ignoreWarnings = [
function ignoreSourcemapsloaderWarnings(warning) {
return (
warning.module &&
warning.module.resource.includes("node_modules") &&
warning.details &&
warning.details.includes("source-map-loader")
);
}
];
return webpackConfig;
}
}
};