forked from PawCorp/joi.how
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfig-overrides.js
More file actions
33 lines (29 loc) · 1.08 KB
/
config-overrides.js
File metadata and controls
33 lines (29 loc) · 1.08 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
const path = require('path')
const webpack = require('webpack')
module.exports = function(config, env) {
// Add an exclusion rule to prevent the file-loader being used
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);
}
});
});
// Add a dedicated loader for WASM
config.module.rules.push({
test: wasmExtensionRegExp,
include: path.resolve(__dirname, 'src'),
use: [{ loader: require.resolve('wasm-loader'), options: {} }]
});
// Tell webpack to use the Web, rather than NodeJS, version of Buttplug
config.plugins.push(
new webpack.NormalModuleReplacementPlugin(/^#/, resource => {
if (resource.request === "#buttplug_rs_ffi_bg") {
resource.request = "./buttplug_rs_ffi_bg_web.js"
}
})
)
return config;
}