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 non existing paths. #49010

Closed
jimmywarting opened this issue Aug 3, 2023 · 1 comment · Fixed by #49038
Closed

import.meta.resolve non existing paths. #49010

jimmywarting opened this issue Aug 3, 2023 · 1 comment · Fixed by #49038

Comments

@jimmywarting
Copy link

Version

v20.5.0

Platform

Darwin jimmy.local 22.4.0 Darwin Kernel Version 22.4.0: Mon Mar 6 20:59:28 PST 2023; root:xnu-8796.101.5~3/RELEASE_ARM64_T6000 arm64

Subsystem

No response

What steps will reproduce the bug?

import.meta.resolve('./' + Math.random())

How often does it reproduce? Is there a required condition?

Deno and browser dose not look up any module when resolving paths.
it's more or less a direct approach to new URL('./dist', import.meta.url).toString() with also regards to import-maps..

What is the expected behavior? Why is that the expected behavior?

i did kind of expect import.meta.resolve('./dist) to work more or less similar to: new URL('./dist', import.meta.url).toString() or how the browsers import.meta.resolve works... but it did not. it throws an error instead

i kind of expect all of the node_modules folder + node core modules to behave more or less import-maps
and import.meta.resolve('dust) to throw an TypeError

TypeError: Failed to execute 'resolve' on 'import.meta': Failed to resolve module specifier "dust": Relative references must start with either "/", "./", or "../". Or using import-maps

What do you see instead?

One thing that's happening in NodeJS is:

Error [ERR_MODULE_NOT_FOUND]: Cannot find module <X> imported from <Y>

Additional information

No response

@guybedford
Copy link
Contributor

guybedford commented Aug 6, 2023

I agree this is a bug, and didn't realise it hadn't yet been resolved. I've created the PR in #49038 to include support for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants