oven-sh / bun

Incredibly fast JavaScript runtime, bundler, test runner, and package manager – all in one
https://bun.sh
Other
73.51k stars 2.71k forks source link

bun build --target node does not bundle "punycode/" #11998

Open CristianPi opened 3 months ago

CristianPi commented 3 months ago

What version of Bun is running?

1.1.15+b23ba1fe1

What platform is your computer?

Linux 6.9.4-200.fc40.x86_64 x86_64 unknown

What steps can reproduce the bug?

just run the build with any dependency that use punycode/, like "mongodb": "6.7.0", bun build ./file.ts --outdir ./file-folder --target node

run the file, crash with

{ "errorType": "Runtime.ImportModuleError", "errorMessage": "Error: Cannot find module 'punycode/'\nRequire stack:\n- /var/task/index.mjs", "trace": [ "Runtime.ImportModuleError: Error: Cannot find module 'punycode/'", "Require stack:", "- /var/task/index.mjs", " at _loadUserApp (file:///var/runtime/index.mjs:1087:17)", " at async UserFunction.js.module.exports.load (file:///var/runtime/index.mjs:1119:21)", " at async start (file:///var/runtime/index.mjs:1282:23)", " at async file:///var/runtime/index.mjs:1288:1" ] }

What is the expected behavior?

to bundle the module punycode

What do you see instead?

i see a __require("punycode/");

Additional information

No response

github-actions[bot] commented 2 weeks ago

Hello @CristianPi. Please provide a minimal reproduction using a GitHub repository, Replit, or CodeSandbox. Issues marked with needs repro will be closed if they have no activity within 3 days.