Last active
January 27, 2021 15:14
-
-
Save nyan-left/26fefe95238519df9c81373aa9c9869f to your computer and use it in GitHub Desktop.
Zappar React Three Fiber + CRA rewired config
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = { | |
webpack: function (config, env) { | |
config.module.rules = config.module.rules.map(rule => { | |
if (rule.oneOf instanceof Array) { | |
rule.oneOf[rule.oneOf.length - 1].exclude = [/\.(js|mjs|zbin|jsx|ts|tsx)$/, /\.html$/, /\.json$/]; | |
return { | |
...rule, | |
oneOf: [{ | |
test: /zcv\.wasm$/, | |
type: "javascript/auto", | |
loader: "file-loader", | |
options: { | |
outputPath: 'zcv', | |
name: '[name].[ext]', | |
}, | |
}, | |
...rule.oneOf | |
] | |
}; | |
} | |
return rule; | |
}); | |
config.resolve.extensions.push(".wasm") | |
return config; | |
}, | |
jest: function (config) { | |
return config; | |
}, | |
devServer: function (configFunction) { | |
return function (proxy, allowedHost) { | |
const config = configFunction(proxy, allowedHost); | |
return config; | |
}; | |
}, | |
paths: function (paths, env) { | |
return paths; | |
}, | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment