You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
which causes a reference error at runtime when trying to require the built module:
ReferenceError: exports2 is not defined
at /Users/airhorns/Code/esbuild-test/build/test.js:622:18
at /Users/airhorns/Code/esbuild-test/build/test.js:11:5
at /Users/airhorns/Code/esbuild-test/build/test.js:648:17
at /Users/airhorns/Code/esbuild-test/build/test.js:11:5
at Object.<anonymous> (/Users/airhorns/Code/esbuild-test/build/test.js:7780:34)
at Module._compile (node:internal/modules/cjs/loader:1091:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1120:10)
at Module.load (node:internal/modules/cjs/loader:971:32)
at Function.Module._load (node:internal/modules/cjs/loader:812:14)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:76:12)
because the exports2 variable that's normally passed in to the module closure is not.
I am trying to bundle a module from npm (
graphql-ws
) that includes a file in it's tarball (node_modules/graphql-ws/lib/types.mjs
) with these contents:When I use esbuild to bundle a module that depends on this package, esbuild compiles it to:
which causes a reference error at runtime when trying to require the built module:
because the
exports2
variable that's normally passed in to the module closure is not.I am bundling with
esbuild --bundle --target=es2017 --platform=node
onv0.8.54
. Here's a full reproduction where you can runyarn test
to demonstrate the issue: https://github.com/airhorns/esbuild-empty-module-reproThe built code is just fine when not using
--platform=node
as well.Thanks for any help you can give me!
The text was updated successfully, but these errors were encountered: