New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
import.meta.require is not a function error after target: "node" build #5707
Comments
Got the same issue, tmp solution works! |
I managed to turn @Dugnist's temp solution into one that works on both regular and minified output by inserting this line at the top of the output instead:
It's essentially a polyfill for the missing |
Adding to @Dugnist and @mbklein 's solutions, I managed to read and write files by stream so that builds do not fail even if the file size is large.
|
A number of issues are connected to this
Looks like #6168 (comment) got a workaround while we wait for a solution. |
import.meta.require
in bundled code when building with target: "node"
#5154
Duplicate of #6168 |
What version of Bun is running?
1.0.2+37edd5a6e389265738e89265bcbdf2999cb81a49
What platform is your computer?
Linux 6.2.0-32-generic x86_64 x86_64 Ubuntu 22.04.3 LTS
What steps can reproduce the bug?
/cli/build.ts
file:bun run ./cli/build.ts
/build/production.js
node ./build/production.js
build/production.js
code generated by bun before main logic:What is the expected behavior?
node ./build/production.js
should work. Require should handle ESM imports.What do you see instead?
TypeError: (intermediate value).require is not a function
Additional information
I made a temporary solution:
/cli/build.ts
The text was updated successfully, but these errors were encountered: