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

import.meta.resolve(Sync) should not throw error when module file cannot be found #8928

Closed
vveisard opened this issue Feb 15, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@vveisard
Copy link
Contributor

vveisard commented Feb 15, 2024

What version of Bun is running?

1.0.26+c75e768a6

What platform is your computer?

Linux 5.15.133.1-microsoft-standard-WSL2 x86_64 x86_64

What steps can reproduce the bug?

Using import.meta.resolve or import.meta.resolveSync for a module which does not exist will throw an error.

console.log(import.meta.resolveSync("./render.png"));

What is the expected behavior?

I expect the behavior/ implementation of import.meta.resolve to be compatible with the specification, and make no attempt to access the path.

What do you see instead?

import.meta.resolve throws an error instead.

error: Cannot find module "./render.png" from ...

Additional information

My goal is to determine the path of a file which does not yet exist and to write some asset to it.

@vveisard vveisard added the bug Something isn't working label Feb 15, 2024
@jdalton
Copy link
Contributor

jdalton commented Feb 16, 2024

📓 Node has tweaked its implementation to not error in exact file references too:
nodejs/node#49038

@paperdave
Copy link
Member

a duplicate of #2472. this function is implemented completely incorrect in terms of what node and the browser does an the linked issue is about fixing it.

@paperdave paperdave closed this as not planned Won't fix, can't repro, duplicate, stale Feb 17, 2024
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

3 participants