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
Bundling a script depending on jsdom is broken. To reproduce:
bun install jsdom
# create the script
cat <<EOF > jsdom.js import { JSDOM } from 'jsdom';console.log(JSDOM);EOF# bundling
bun build jsdom.js --target=node --outfile=bundled.js
# running (it works)
bun run bundled.js
# > [class JSDOM]# but it reference an external file read from node_modules/jsdom. Removing this file breaks the bundled script
rm -r node_modules/jsdom
bun run bundled.js
# > error: Cannot find module "/Users/mquandalle/myproject/node_modules/jsdom/lib/jsdom/living/xhr/xhr-sync-worker.js" from "/Users/mquandalle/myproject/bundled.js"
The error is caused by the following line in the bundled.js:
It should either copy the file alongside the generated index.js like @vercel/ncc does or directly embed the content inside. Worst part is that the link is an absolute path, so if that build was done in another machine, it will use the absolute path of it and is not runnable in any other environment.
What version of Bun is running?
1.1.27+267afa293
What platform is your computer?
Darwin 24.0.0 arm64 arm
What steps can reproduce the bug?
Bundling a script depending on
jsdom
is broken. To reproduce:The error is caused by the following line in the
bundled.js
:What is the expected behavior?
No response
What do you see instead?
No response
Additional information
No response
The text was updated successfully, but these errors were encountered: