sql.js
sql.js copied to clipboard
Add support for es module and browser-only environment
This PR addresses #284.
I've tested this change using the current create-react-app along with this webpack config:
configure: (webpackConfig) => {
webpackConfig.resolve.extensions.push(".wasm");
webpackConfig.experiments = {
asyncWebAssembly: true,
topLevelAwait: true,
};
webpackConfig.module.rules.forEach((rule) => {
(rule.oneOf || []).forEach((oneOf) => {
if (oneOf.type === "asset/resource") {
oneOf.exclude.push(/\.wasm$/);
}
});
});
return webpackConfig;
},