Skip to content

Instantly share code, notes, and snippets.

@nyan-left
Last active January 27, 2021 15:14
Show Gist options
  • Save nyan-left/26fefe95238519df9c81373aa9c9869f to your computer and use it in GitHub Desktop.
Save nyan-left/26fefe95238519df9c81373aa9c9869f to your computer and use it in GitHub Desktop.
Zappar React Three Fiber + CRA rewired config
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