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
esbuild-svelte ignores *.svelte.js and *.svelte.ts files containing runes from svelte 5.
To compile them, we would need to:
Alter the default value of the include option (something like /\.svelte(\.ts|\.js)?$/)
Detect module files before compilation and instead of calling the compile function call compileModule from 'svelte/compiler'.
This would solve the problem for 'svelte.js' files, but not for 'svelte.ts', because sveltePreprocess only compiles svelte components. Maybe we could compile/preprocess them with esbuild before calling compileModule?
Thx!
The text was updated successfully, but these errors were encountered:
This is interesting, thank you for bringing this to my attention.
I agree with your prognosis, supporting *.svelte.js files will be straightforward. Supporting TS svelte modules will be less straightforward, however using esbuild to transform TS into JS seems like the best path.
Update: Svelte 5 appears to natively support basic TS syntax. I'm debating whether the added complexity is worth it to compile module files down to JS before running through compileModule or do we rely on folks not wanting to use any of the unsupported native features.
Super excited for this! Since you mentioned TS modules might be tricky, consider supporting .svelte.js without .svelte.ts for a first iteration as that would allow some usage of esbuild-svelte with Svelte 5.
esbuild-svelte ignores *.svelte.js and *.svelte.ts files containing runes from svelte 5.
To compile them, we would need to:
include
option (something like/\.svelte(\.ts|\.js)?$/
)compile
function callcompileModule
from 'svelte/compiler'.This would solve the problem for 'svelte.js' files, but not for 'svelte.ts', because sveltePreprocess only compiles svelte components. Maybe we could compile/preprocess them with esbuild before calling compileModule?
Thx!
The text was updated successfully, but these errors were encountered: