-
Notifications
You must be signed in to change notification settings - Fork 2
/
craco.config.js
34 lines (30 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
// You can also use craco-alias plugin: https://github.com/risenforces/craco-alias
const webpack = require('webpack');
module.exports = {
webpack: {
configure: (webpackConfig) => {
const wasmExtensionRegExp = /\.wasm$/;
webpackConfig.resolve.extensions.push('.wasm');
webpackConfig.experiments = {
asyncWebAssembly: true,
// lazyCompilation: true,
// syncWebAssembly: true,
// topLevelAwait: true,
};
webpackConfig.resolve.fallback = {
buffer: require.resolve('buffer/')
}
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'],
}));
return webpackConfig;
}
}
}