diff --git a/lib/binding_web/script/build.js b/lib/binding_web/script/build.js index 737267a11..f48ff1ee2 100644 --- a/lib/binding_web/script/build.js +++ b/lib/binding_web/script/build.js @@ -44,6 +44,9 @@ async function build() { keepNames: true, external: ['fs/*', 'fs/promises'], resolveExtensions: ['.ts', '.js', format === 'esm' ? '.mjs' : '.cjs'], + ...(format === 'cjs' ? { + footer: { js: 'module.exports.default = module.exports;' }, + } : {}), }); // Copy the Wasm files to the appropriate spot, as esbuild doesn't "bundle" Wasm files