Closed kansson closed 9 months ago
i'm having the same problem but with node
This is probably caused by #4274
The issue us not about bunjs, but about locating the node_modules
folder which might be in a parent folder when using workspaces.
I believe the code block shared above was generated with the assumption of having the node_modules
folder at the Svelte project's source root, which does not comply with the resolution strategy of Node.js either. All the runtimes that I tried before would search packages in node_modules
folders under all the parent folders by traversing up until the package is found.
The code generation should not assume having the node_modules
in the Svelte project root.
Until fixed, a remedy is to create a symlink to the actual node_modules
folder inside the SvelteKit project root:
/my/workspace/svelte/project/ $ ln -s ../../node_modules ./
edit: I was just browsing on the tablet and didn't realize this was under bunjs repo. This specific problem is in Svelte Kit (or maybe vitejs), not bun, unless the bogus path (../../....) was gathered from bun api by the mentioned modules.
This appears to be functioning correctly now with Bun v1.0.3
. If anyone encounters this error, please leave a reply, and I will reopen the issue.
What version of Bun is running?
0.7.4
What platform is your computer?
Darwin 22.6.0 arm64 arm
What steps can reproduce the bug?
Create Bun project with workspaces and a SvelteKit app. Run the Vite dev server inside Bun using the latest version of all packages.
What is the expected behavior?
The dev server should start without any error.
What do you see instead?
Additional information
The problem is that SvelteKit can't find the component as it's hoisted to the root
node_modules
in the project. Maybe this should work if Vite used Buns bundler and module resolution?