-
-
Notifications
You must be signed in to change notification settings - Fork 6.4k
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
Changes to external css file or external ts file used in svelte file does not trigger reload with HMR #2633
Comments
Can you provide a link to a repo with a reproduction |
@JacobClevenger thank you for the quick response. Here is a link to the public repo. |
I have similar issue with with imported css. I do workaround directly with import.meta.hot.on and manual cache buster
PS. There is "new" css imported every time due to cache buster and it's been said that its |
TL;DR: Until something changes in ESM, leak is unsolved and eventually will fill up all ram. Also vite log will point to every past link in one big wall of "hmr update /css...." |
Can't reproduce this with https://github.com/NiQ-B/test-vite, the changes in the external files trigger HMR immediately after updating to the latest version of https://github.com/sveltejs/vite-plugin-svelte. @ambrt Do you have a repro too? IIUC vite-plugin-svelte should be handling this scenario's well. We should report the issue there too. |
Describe the bug
A clear and concise description of what the bug is.
Changes to external .css files or external .ts files configured as src documents in the svelte file does not trigger hot module reload. A save on the parent svelte file is required to trigger the update.
Inline style and script ts tags and code works as expected with hmr.
After testing on both a sveltekit@next and vite svelte ts template, I have narrowed down the issue to vite or vite - svelte-preprocessor integration.
Have tried to add css files to the vite.config.js server.watch options with a src/**/*.css glob.
// https://vitejs.dev/config/
export default defineConfig({
server: {
watch: [
'src/**/*.css'
]
},
clear: false,
plugins: [svelte()]
})
See relevant log items below, vite shows that the change is recognized by watch but does not have a module to update even though the src attribute has the name.
Logs (Optional if provided reproduction)
vite:hmr [file change] src/_index.css +4m
vite:hmr [no modules matched] src/_index.css +0m
Reproduction
_index.css - contents
Please provide a link to a repo that can reproduce the problem you ran into.
A reproduction is required unless you are absolutely sure that the the problem is obvious and the information you provided is enough for us to understand what the problem is. If a report has only vague description (e.g. just a generic error message) and has no reproduction, it will receive "need reproduction" label. If no reproduction is provided after 3 days, it will be auto-closed.
System Info
vite
version: 2.1.0Logs (Optional if provided reproduction)
vite:hmr [file change] src/_index.css +4m
vite:hmr [no modules matched] src/_index.css +0m
vite
orvite build
with the--debug
flag.The text was updated successfully, but these errors were encountered: