-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathconfig-overrides.js
More file actions
54 lines (48 loc) · 1.16 KB
/
Copy pathconfig-overrides.js
File metadata and controls
54 lines (48 loc) · 1.16 KB
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
47
48
49
50
51
52
53
54
const webpack = require("webpack")
let commitHash;
try {
commitHash = require('child_process')
.execSync('git rev-parse --short HEAD')
.toString()
.trim();
} catch (e) {
commitHash = 'unknown';
}
module.exports = function override(config, env) {
//do stuff with the webpack config...
config.experiments = {
asyncWebAssembly: true,
topLevelAwait: true,
};
config.resolve.fallback = {
...config.resolve.fallback,
buffer: require.resolve("buffer"),
module: false,
path: false,
fs: false,
url: false,
crypto: false,
}
config.module.rules
.find((i) => "oneOf" in i)
.oneOf.find((i) => i.type === "asset/resource")
.exclude.push(/\.wasm$/);
config.module.rules.unshift({
test: /\.m?js$/,
resolve: {
fullySpecified: false, // disable the behavior
},
});
config.resolve.extensions = [...config.resolve.extensions, ".ts", ".js"]
config.plugins = [
...config.plugins,
new webpack.DefinePlugin({
__COMMIT_HASH__: JSON.stringify(commitHash)
}),
new webpack.ProvidePlugin({
process: "process/browser",
Buffer: ["buffer", "Buffer"],
}),
]
return config
}