Replies: 1 comment
-
// tsup.config.ts
import { defineConfig } from "tsup";
export default defineConfig({
banner: {
js: `import {createRequire as __createRequire} from 'module';var require=__createRequire(import\.meta.url);`,
},
});Shouldn't we use |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
If you're building in esm format, and one of your dependency is written in CJS and you want to bundle it, the result code might contain
requirecall:That's because built-in modules can't be resolved and esbuild just leaves it as is, a workaround is to use the
banner.jsoption to makerequireavailable in your esm bundle:Beta Was this translation helpful? Give feedback.
All reactions