sql.js icon indicating copy to clipboard operation
sql.js copied to clipboard

Add support for es module and browser-only environment

Open stephen opened this issue 2 years ago • 0 comments

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;
},

stephen avatar Jan 02 '23 14:01 stephen