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
And I just imported a Vant Button in Home.vue , and added a custom className to it for rewriting it's style.
Run in dev mode (yarn dev), my custom css worked normally and intuitively. But in prod mode (yarn serve), the default css of the Vant Button was bundled in index.css, and my custom css was bundled in Home.css as the <!--preload-links--> which was injected before the index.css:
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 vuejs/core instead.
LyzSg
changed the title
The order of css <link> tags after SSR prerender is difference from that in development
The order of css <link> tags in index.html after SSR prerender is different from that in development
Jul 15, 2022
Describe the bug
My demo is based on vite ssr-vue example.
And I just imported a Vant Button in
Home.vue
, and added a custom className to it for rewriting it's style.Run in dev mode (yarn dev), my custom css worked normally and intuitively. But in prod mode (yarn serve), the default css of the Vant Button was bundled in
index.css
, and my custom css was bundled inHome.css
as the<!--preload-links-->
which was injected before theindex.css
:dist/index.html:
Because their selectors' weights are consistent, the original style of the component takes effect.
So in order to solve this problem, should I put the preload links behind the style generated by the build instead of before it?
Before:
After?:
Will this destroy the performance improvement brought by preloading?
Or extract the CSS file from the preload links separately and put it in front of the end of head tag?
Wish for a recommended way. Thanks!!
Reproduction
https://github.com/LyzSg/vite-vue-ssr-demo
System Info
Used Package Manager
yarn
Logs
No response
Validations
The text was updated successfully, but these errors were encountered: