new URL('.', import.meta.url)
throws EISDIR error during build
#7364
Labels
new URL('.', import.meta.url)
throws EISDIR error during build
#7364
Describe the bug
Demo repo: https://github.com/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://github.com/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: