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.url, with a comma at the end causes the build not to take effect #6978

Closed
7 tasks done
gemone opened this issue Feb 18, 2022 · 0 comments · Fixed by #6983
Closed
7 tasks done

import.meta.url, with a comma at the end causes the build not to take effect #6978

gemone opened this issue Feb 18, 2022 · 0 comments · Fixed by #6983

Comments

@gemone
Copy link

gemone commented Feb 18, 2022

Describe the bug

Commas affect import.meta.url .

The following code development environment is normal, but the compilation will lead to the invalidation of the whole page:

const url = new URL(
  './favicon.svg',
  import.meta.url,
).href;

try:

npx vite build && npx vite preview

the page not work;

npx vite
# page work

Normal after removing comma:

const url = new URL(
  './favicon.svg',
  import.meta.url
).href;
# all work

Reproduction

https://stackblitz.com/edit/vitejs-vite-xwbawm?file=main.js

System Info

System:
    OS: Linux 5.10 Gentoo/Linux
    CPU: (4) x64 Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz
    Memory: 1.48 GB / 7.68 GB
    Container: Yes
    Shell: 5.1.16 - /bin/bash
  Binaries:
    Node: 14.17.6 - /usr/bin/node
    Yarn: 1.22.15 - ~/.local/share/npm/bin/yarn
    npm: 8.4.1 - ~/.local/share/npm/bin/npm
  Browsers:
    Firefox: 91.6.0esr
  npmPackages:
    vite: ^2.7.13 => 2.7.13 

## Attempts to update vite will not take effect

Used Package Manager

npm

Logs

No response

Validations

@github-actions github-actions bot locked and limited conversation to collaborators Mar 9, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant