You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
Make sure this is a Vite issue and not a framework-specific issue. For example, if it's a Vue SFC related bug, it should likely be reported to https://github.com/vuejs/core instead.
Describe the bug
Inside
<body>
or<head>
ofindex.html
, the following code:Does not cause
index.html
to reload or for the css to be replaced when./style.css
is edited and saved.The
@import
is considered anisDirectCSSRequest
here:vite/packages/vite/src/node/plugins/css.ts
Lines 295 to 297 in 33f9671
The
ModuleNode
will look like that:Editing and saving
./style.css
logs out:12:09:54 PM [vite] hmr update /style.css?direct
However, no actual update takes place, unlike when doing
import './style.css';
inmain.js
which hasModuleNode
like:And hits this code instead of
isDirectCSSRequest
:vite/packages/vite/src/node/plugins/css.ts
Lines 305 to 318 in 33f9671
Which results in that being logged to console upon editing
./style.css
:hmr update /style.css
If you were to edit
index.html
when only using@import
, by adding a space somewhere and saving the file, that is logged to console:12:17:20 PM [vite] page reload index.html
And the CSS changes from the
@import
-ed./style.css
are updated.Therefore, it seems one solution may be to trigger
page reload index.html
when@import
-ed css files are edited.Reproduction
https://stackblitz.com/edit/vitejs-vite-flhjoj?file=style.css
System Info
Used Package Manager
npm
Logs
No response
Validations
The text was updated successfully, but these errors were encountered: