esm.sh
esm.sh copied to clipboard
Deno + esbuild: ReferenceError: require is not defined
error: Uncaught ReferenceError: require is not defined at https://cdn.esm.sh/v15/[email protected]/esnext/esbuild.js:8:1378 at https://cdn.esm.sh/v15/[email protected]/esnext/esbuild.js:1:754 at https://cdn.esm.sh/v15/[email protected]/esnext/esbuild.js:8:4069
I can find a require("child_process") in esbuild.js, which I think is what causes the issue.
esbuild seems like one of those projects that are too big/complex to be able to just use through a CDN for Deno support
I can find a require("child_process") in esbuild.js, which I think is what causes the issue.
Well kind of. esm.sh at the start of each file adds imports to all depenendcies and then creates a require function which takes the name of a package and just returns the result of that import. It seems require is being used but a require function at the top isn't being generated.
esbuild on Node.js uses worker_threads which is not yet supported by Deno std/node but you can use deno esbuild port instead