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

Edit of imported inline css, HMR reports as page importing and not css file itself #6203

Closed
7 tasks done
ambrt opened this issue Dec 20, 2021 · 2 comments
Closed
7 tasks done

Comments

@ambrt
Copy link

ambrt commented Dec 20, 2021

Describe the bug

I'm not sure if its Vite's problem or vite-plugin-svelte so i cross post here.
I'm using latest sveltekit and in short if css is imported inline .css?inline
and saved ,vite reports it as edit of file that was importing it and not name of css itself.
Repro is here:
https://github.com/ambrt/inline-css-bug-vite
Cross post bug is here
sveltejs/vite-plugin-svelte#232

Reproduction

https://github.com/ambrt/inline-css-bug-vite

System Info

System:
    OS: Linux 5.4 Ubuntu 20.04.3 LTS (Focal Fossa)
    CPU: (2) x64 Intel(R) Core(TM)2 Duo CPU     E8400  @ 3.00GHz
    Memory: 136.91 MB / 7.77 GB
    Container: Yes
    Shell: 5.0.17 - /bin/bash
  Binaries:
    Node: 16.2.0 - ~/.nvm/versions/node/v16.2.0/bin/node
    Yarn: 1.22.17 - /usr/local/bin/yarn
    npm: 8.1.4 - ~/.nvm/versions/node/v16.2.0/bin/npm
    Watchman: 20201115.021953.0 - /usr/local/bin/watchman
  Browsers:
    Chrome: 91.0.4472.164
    Firefox: 95.0
  npmPackages:
    vite: ^2.6.14 => 2.6.14

Used Package Manager

npm

Logs

No response

Validations

@ambrt ambrt changed the title Edit of imported inline css HMR reports as page importing and not css file itself Edit of imported inline css, HMR reports as page importing and not css file itself Dec 20, 2021
@ambrt
Copy link
Author

ambrt commented Dec 21, 2021

Problem is appearing in Vite API import.meta.hot.on("vite:beforeUpdate", (data) => {}) which is exactly problem that i have.
path value shows as index.svelte and not front.css.
(I use it to switch custom store value based on file being saved in editor)

@bluwy bluwy added the feat: hmr label Apr 1, 2022
@sapphi-red
Copy link
Member

AFAIK this is intended.
When you edit front.css, HMR is handled by the HMR boundary (index.svelte) and path value returns HMR boundary path.

path: boundary.url,

@sapphi-red sapphi-red closed this as not planned Won't fix, can't repro, duplicate, stale Jul 10, 2022
@github-actions github-actions bot locked and limited conversation to collaborators Jul 25, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants