farm-fe / farm

Extremely fast Vite-compatible web build tool written in Rust
https://farmfe.org
MIT License
5k stars 165 forks source link

[Bug Report]: Farm Not working with Svelte 5. #1935

Closed JakubCzarlinski closed 4 hours ago

JakubCzarlinski commented 1 day ago

Steps to reproduce

  1. bun create farm@latest
  2. Select svelte template.
  3. cd farm-project
  4. bun install - this installs svelte 4
  5. bun run dev - works
  6. bun install svelte@latest @sveltejs/vite-plugin-svelte@latest svelte-check@latest - this installs svelte 5
  7. bun run dev - this fails.
  8. bun run build && bun run preview - this also fails.

Example:

https://github.com/JakubCzarlinski/farm-svelte-5-issue

Reproduce link

https://github.com/JakubCzarlinski/farm-svelte-5-issue

What is actually happening?

Updating to Svelte 5 errors on page render in both dev and prod build when using Farm.

System Info

System:
    OS: Linux 6.11 CachyOS Linux
    CPU: (24) x64 AMD Ryzen 9 7900 12-Core Processor
    Memory: 49.36 GB / 61.94 GB
    Container: Yes
    Shell: 5.9 - /usr/bin/zsh
  Binaries:
    Node: 22.9.0 - /usr/bin/node
    npm: 10.9.0 - /usr/bin/npm
    bun: 1.1.34 - ~/.bun/bin/bun
  npmPackages:
    @farmfe/core: ^1.3.0 => 1.3.33
ErKeLost commented 23 hours ago

in svelte 5 you should change mount method

import App from './App.svelte';
import { mount } from 'svelte';
const app = mount(App, { target: document.getElementById("app") });
export default app;

and the latest vite plugin use some not support config in farm we will fix it

image

You can temporarily add the optional chain operator in source code

options.server?.config.experimental?. hmrPartialAccept

Of course, this will not affect build and preview its happend in development

We will find a way to fix this problem as soon as possible

its work well

image
JakubCzarlinski commented 4 hours ago

Ah my bad forgot about that. Thank you!