-
-
Notifications
You must be signed in to change notification settings - Fork 6.2k
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
fix: style hmr reduce replace style code #7869
Conversation
For this error: https://github.com/vitejs/vite/runs/6131322405?check_suite_focus=true#step:9:109 @sapphi-red this PR just use the style update hmr don't render css, can I remove the vite/packages/playground/css-sourcemap/__tests__/serve.spec.ts Lines 20 to 80 in 95e1a8c
|
I think it is ok to remove that test. |
It looks like URL rebasing is not working. <style>
.wrapper {
background: url('./ok.png');
}
</style> Also other transforms are not working, <style>
.wrapper {
.linked {
color: blue;
}
}
</style> These does not work during dev, but it does work after build. |
Co-authored-by: 翠 / green <green@sapphi.red>
vite/packages/playground/assets/index.html Lines 202 to 213 in 6bae2a3
I think the below code is expected. css also no support this syntax.
|
This works when I access |
@sapphi-red @bluwy @patak-dev compileCSSHTML Now it seems that this method is the best solution. because if use the prev way and make the if use script patch it, the first screen is used unexpected css. I don't know if there is any other better way 🤔 |
@poyoho I was also thinking the same while reviewing this PR, I forgot you already explored compiling the inline CSS before. +1 to revisit that approach. |
now all the request css is go to replace the raw css. CSS request can reduce coupled between html and css plugin. But now css request seems to no work well. |
#6859 is seems not a bug in vite |
Co-authored-by: patak <matias.capeletto@gmail.com>
This is a great direction 43c3dce! |
css request had too many bug, let clean all the css request in this time. 🤦 |
I think we should merge this PR and test it against vite-ecosystem-ci. I hope this is the last piece to stabilize 2.9, awesome work here @poyoho. |
I found a bug. (an edge case)
|
It was not only with css.
|
how about removing the judge? vite/packages/vite/src/client/client.ts Lines 108 to 109 in c30793c
when |
I think vite/packages/vite/src/client/client.ts Line 106 in c30793c
I feel it is ok to reload regardless to |
It is? if (payloadPath === '/index.html') page.reload() I think so. How about you @patak-dev 👀 |
@poyoho @sapphi-red I think we should create a new issue for that problem, as it is unrelated to this PR. It is strange we didn't get more reports for this issue before. Let's focus on the issue being solved in this PR here. |
Description
fix: #7836
fix: #7913
fix: #6737
fix: #7952
Additional context
The previous method of replacing a style with script insertion may cause style priority issues and some style updates are invalid because middleware doesn't compile index HTML every time. So the update only needs to make the connection between CSS (including nested CSS) and Html and if HTML update will
full-reload
.What is the purpose of this pull request?
Before submitting the PR, please make sure you do the following
fixes #123
).