Skip to content

Commit 8f30f36

Browse files
committed
Patch jiti
1 parent ef3dbde commit 8f30f36

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

esbuild.mjs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,22 @@ let ctx = await esbuild.context({
4040
}))
4141
},
4242
},
43+
{
44+
name: 'patch-jiti',
45+
setup(build) {
46+
// TODO: Switch to rolldown and see if we can chunk split this instead?
47+
build.onLoad({ filter: /jiti\/lib\/jiti\.mjs$/ }, async (args) => {
48+
let original = await fs.readFile(args.path, 'utf8')
49+
50+
return {
51+
contents: original.replace(
52+
'createRequire(import.meta.url)("../dist/babel.cjs")',
53+
'require("../dist/babel.cjs")',
54+
),
55+
}
56+
})
57+
},
58+
},
4359
{
4460
// https://github.com/evanw/esbuild/issues/1051#issuecomment-806325487
4561
name: 'native-node-modules',

0 commit comments

Comments
 (0)