-
Notifications
You must be signed in to change notification settings - Fork 79
/
craco.config.js
45 lines (44 loc) · 1.13 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
const webpack = require('webpack');
module.exports = {
webpack: {
configure: {
resolve: {
fallback: {
crypto: require.resolve('crypto-browserify'),
http: require.resolve('stream-http'),
https: require.resolve('https-browserify'),
stream: require.resolve('stream-browserify'),
os: require.resolve('os-browserify/browser'),
zlib: require.resolve('browserify-zlib'),
process: require.resolve('process/browser'),
},
},
module: {
rules: [
{
test: /\.wasm$/,
type: 'webassembly/sync',
},
{
test: /\.m?js$/,
resolve: {
fullySpecified: false, // disable the behaviour
},
},
],
},
experiments: {
syncWebAssembly: true,
topLevelAwait: true, // so we can do `const lib = await import('libraryName');`
},
},
plugins: {
add: [
new webpack.ProvidePlugin({
Buffer: ['buffer', 'Buffer'],
process: 'process/browser',
}),
],
},
},
};