Describe the bug
CSS loaded via <link href /> within <body/> fails to hot reload. While putting stylesheets in the <head /> is best practice, our environment does not allow this. Vite puts stylesheet updates in the <head /> regardless so it does not override stylesheets below it. I would expect vite to:
- Insert style updates directly after the element that creates it, rather than at the end of the
<head />
- Or, add a timestamp to the
href so the browser refreshes the stylesheet directly (browsersync does this).
<link rel="stylesheet" href="/src/test.css?TIMESTAMP"/>
Reproduction
Please provide a link to a repo that can reproduce the problem you ran into.
https://github.com/briantjacobs/test_vite
Steps taken in repo:
npm init vite-app TEST_VITE
<body>
<link rel="stylesheet" href="/src/test.css"/>
<div id="app"></div>
<script type="module" src="/src/main.js"></script>
</body>
- Add
test.css to src folder:
- Change the css to
background:red and save. Only manual reloads refresh the stylesheet. Moving the <link/> to <head/> and hot reload works great.
System Info
- required
vite version: 1.0.0-beta.3
- required Operating System: OSX 10.14.4
- required Node version: v12.8.0
- Optional:
- npm/yarn version
- Installed
vue version (from yarn.lock or package-lock.json)
- Installed
@vue/compiler-sfc version
Logs (Optional if provided reproduction)
- Run
vite or vite build with the --debug flag.
- Provide the error log here.
Describe the bug
CSS loaded via
<link href />within<body/>fails to hot reload. While putting stylesheets in the<head />is best practice, our environment does not allow this. Vite puts stylesheet updates in the<head />regardless so it does not override stylesheets below it. I would expect vite to:<head />hrefso the browser refreshes the stylesheet directly (browsersync does this).<link rel="stylesheet" href="/src/test.css?TIMESTAMP"/>Reproduction
Please provide a link to a repo that can reproduce the problem you ran into.
https://github.com/briantjacobs/test_vite
Steps taken in repo:
test.csstosrcfolder:background:redand save. Only manual reloads refresh the stylesheet. Moving the<link/> to<head/>and hot reload works great.System Info
viteversion: 1.0.0-beta.3vueversion (fromyarn.lockorpackage-lock.json)@vue/compiler-sfcversionLogs (Optional if provided reproduction)
viteorvite buildwith the--debugflag.