Skip to content
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

bun test cannot handle SvelteKit's $env/dynamic/* imports #10712

Open
lackita opened this issue Apr 30, 2024 · 1 comment
Open

bun test cannot handle SvelteKit's $env/dynamic/* imports #10712

lackita opened this issue Apr 30, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@lackita
Copy link

lackita commented Apr 30, 2024

What version of Bun is running?

1.1.6+e58d67b46

What platform is your computer?

Linux 6.5.0-28-generic x86_64 x86_64

What steps can reproduce the bug?

Create a library in a sveltekit project which includes this import:

import { env } from "$env/dynamic/private";

Add a test that imports this module and run that test, you will see an error like this:

error: Cannot find module "$env/dynamic/private" from "/path/to/repo/src/lib/server/env.ts"

Now, if you import that same module in a +page.server.ts file and load the corresponding page, it should load without issue.

What is the expected behavior?

No response

What do you see instead?

No response

Additional information

Seems like this issue also existed in vitest a while back, but SvelteKit solved the problem with this PR.

Note that I'm also using workspaces in my project, so if the instructions above can't replicate the problem it may be related to that. I don't think so because I can still start the server and use the library that way, but always a possibility.

@lackita lackita added the bug Something isn't working label Apr 30, 2024
@emilio-toledo
Copy link

emilio-toledo commented Oct 21, 2024

+1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants