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
That's because vitePreprocess uses esbuild to transpile TS to JS. esbuild unfortunately removes (most) comments by default, so the comment was likely stripped before svelte-hmr sees them.
I'm not really sure how this can be fixed, other than:
Hoping esbuild would support not stripping comments one day. It strips now due to performance reasons.
Use svelte-preprocess and typescript to preprocess lang="ts"
no2 can be used to workaround in the meantime if you rely on this feature. You can turn off script processing in vitePreprocess specifically with vitePreprocess({ script: false }).
esbuild unconditionally stripping comments is a bit of a bummer, but as mentioned already you can switch to svelte-preprocess if you need this behavior.
Describe the bug
If
lang="ts"
then@hmr:keep
is not honored. (@hmr:keep-all
still works).Reproduction
count
Expected: value of
count
is preserved.Actual: value of
count
is reset.Notes:
@hmr:keep-all
works for both JS and TS.Logs
No response
System Info
Severity
annoyance
Additional Information
Reference: https://github.com/sveltejs/svelte-hmr/tree/master/packages/svelte-hmr#svelte-hmr
The text was updated successfully, but these errors were encountered: