-
-
Notifications
You must be signed in to change notification settings - Fork 6.1k
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
new URL('.', import.meta.url)
throws EISDIR error during build
#7364
Labels
Comments
fend25
changed the title
Mar 17, 2022
new URL('.', import.meta.url)
throws build error when used in librarynew URL('.', import.meta.url)
throws EISDIR error during build
7 tasks
just suffered same issue...it's raised in other packages' packageInfo.js, any workarounds? |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Describe the bug
Demo repo: https:/fend25/vite_import_meta_url_dot
TL;DR:
new URL('.', import.meta.url)
throws vite:asset-import-meta-url EISDIR error during build.First of all I want to thank you for such good bundler. It's a huge work and I guess it does and will help people a lot. And while working with this I faced with one strange issue: in build mode (
yarn build
in repo) thenew URL('.', import.meta.url)
expression throws such error to the terminal:In dev mode it works, but one way or another it requires Vite config fine tuning:
Want to mention PR #7279. And maybe it requires to bump the default target versions or clarify it in the documentation a bit louder...
Possible workaround - place for discussion
Since I have no idea what the production build with such expression should work in browser, and I can refer only to the dev environment and the Node.js behaviour, I have come up with such "workaround":
It gives same result as
new URL('.', import.meta.url)
in dev mode and in the Node.js (assuming{type: "module"}
of course)Reproduction
https:/fend25/vite_import_meta_url_dot
System Info
System: OS: Linux 4.15 Ubuntu 18.04.6 LTS (Bionic Beaver) CPU: (6) x64 Intel(R) Core(TM) i5-9400F CPU @ 2.90GHz Memory: 2.81 GB / 7.79 GB Container: Yes Shell: 4.4.20 - /bin/bash Binaries: Node: 16.13.2 - /usr/bin/node Yarn: 1.22.17 - /usr/bin/yarn npm: 8.1.2 - /usr/bin/npm Browsers: Chrome: 99.0.4844.51 npmPackages: vite: ^2.8.0 => 2.8.6
Used Package Manager
yarn
Logs
Validations
The text was updated successfully, but these errors were encountered: