forked from ZhenXunGe/g1024
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathconfig-overrides.js
36 lines (29 loc) · 963 Bytes
/
config-overrides.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
const path = require("path");
const fs = require("fs");
module.exports = function override(config, env) {
console.log(config);
config.module.rules.forEach(rule => {
(rule.oneOf || []).forEach(oneOf => {
if (oneOf.test && oneOf.test.toString().indexOf('tsx') >= 0) {
oneOf.include = [oneOf.include, fs.realpathSync(path.resolve(__dirname, 'node_modules/web3subscriber/', 'src'))]
}
})
})
const wasmExtensionRegExp = /\.wasm$/;
config.resolve.extensions.push('.wasm');
config.module.rules.forEach(rule => {
(rule.oneOf || []).forEach(oneOf => {
if (oneOf.loader && oneOf.loader.indexOf('file-loader') >= 0) {
oneOf.exclude.push(wasmExtensionRegExp)
}
})
})
config.module.rules.push({
test: wasmExtensionRegExp,
include: path.resolve(__dirname, 'src'),
type: "javascript/auto",
use: [{ loader: 'wasm-loader'}]
//use: [{ loader: 'file-loader'}]
})
return config
}