Skip to content

Commit c7c7d46

Browse files
committed
Fix CJS build
1 parent 59357d3 commit c7c7d46

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

scripts/build.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,16 @@ async function build(opts) {
3434

3535
build({
3636
format: 'esm',
37-
// bundle: true,
38-
// splitting: true,
39-
// chunkNames: '__chunks/[name]-[hash]',
4037
});
4138

4239
build({
4340
format: 'cjs',
4441
bundle: true,
4542
outExtension: { '.js': '.cjs' },
43+
footer: {
44+
// Fix `export default {}` assigned to `module.exports.default`
45+
js: 'if (module.exports.default) module.exports = module.exports.default;'
46+
},
4647
plugins: [
4748
// @see https://github.com/evanw/esbuild/issues/622#issuecomment-769462611
4849
{

0 commit comments

Comments
 (0)