-
Notifications
You must be signed in to change notification settings - Fork 45
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.url
returns relative path
#9
Comments
are you using it in ESM code? __dirname is not available in esm anymore, see https://nodejs.org/api/esm.html#esm_no_filename_or_dirname |
ah I see! Wasn't aware of that. Thank you! |
I've updated the issue. |
hi @cusxio , I just verified that in vite the |
So it seems that vite In normal Node, So in vite, we'll need to use The replicate |
https://nodejs.org/api/esm.html#esm_import_meta_url
In the docs, it says that
import.meta.url
returns anabsolute
url, but when I tried it with the example in theexamples
folder,import.meta.url
returns a relative path.I'm trying to replicate __dirname.
Reproduction: https://github.com/cusxio/vite-plugin-node-import
The text was updated successfully, but these errors were encountered: