Skip to content

Commit

Permalink
fix: Allow requiring built-in node modules from ESM CLI (#356)
Browse files Browse the repository at this point in the history
  • Loading branch information
aklinker1 authored Jan 18, 2024
1 parent 148c0da commit 6f0814b
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions scripts/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,11 @@ const config: tsup.Options[] = [
cli: 'src/cli.ts',
},
format: ['esm'],
banner: {
// Fixes dynamic require of nodejs modules. See https://github.com/wxt-dev/wxt/issues/355
// https://github.com/evanw/esbuild/issues/1921#issuecomment-1152991694
js: "import { createRequire } from 'module';const require = createRequire(import.meta.url);",
},
},
];

Expand Down

0 comments on commit 6f0814b

Please sign in to comment.