fable-compiler / Fable.Solid

Fable bindings for SolidJS
http://fable.io/Fable.Solid/
MIT License
51 stars 5 forks source link

Does watching with Vite still work? #16

Closed goswinr closed 7 months ago

goswinr commented 7 months ago

I updated to the latest version of Fable , SolidJs, Vite and vite-plugin-solid. Fable build and watch to recompile to .jsx works, but Vite does not seem to pick up any changes and reload the browser. Please test it on this minimal app: https://github.com/goswinr/Fable.Solid-Test

MangelMaxime commented 7 months ago

Hello @goswinr,

You are probably hitting https://github.com/fable-compiler/Fable/issues/3631.

There is an issue when spawning Vite from Fable command when in watch mode.

Change dotnet fable watch --noCache --outDir ./dist --extension .jsx --run vite to spawn manually spawn 2 terminals or by using concurrently.

[!WARNING] Pseudo code

"scripts": {
    "watch-vite": "npx vite ...",
    "watch-fable": "dotnet fable watch ...",
    "watch": "npx concurrently \"npm:watch-*\"",
}
goswinr commented 7 months ago

Thanks @MangelMaxime, I always learn something new from you . But in my case --run vite actually works fine.

My problem was that vite ignores the dist folder. So just use another --outDir And for solidjs it only watches child components below the root in separate files correctly. I believe this is from the vite-plugin-solidplugin.

I fixed my minimal sample here, see my comments: https://github.com/goswinr/Fable.Solid-Test/commit/6d7a38deb0a04484eee9c81b75999743dde2178f#diff-7ae45ad102eab3b6d7e7896acd08c427a9b25b346470d7bc6507b6481575d519