Open vigneshksaithal opened 8 months ago
@sveltejs/kit/vite
are deeply integrated with Vite, it's not compatible with Farm. You can use @sveltejs/vite-plugin-svelte
instead
@wre232114 tried with @sveltejs/vite-plugin-svelte
but, still getting the same error.
It seems there are syntax issues in app.html
, some plugins that handles app.html
may be missing. What's your original vite.config.ts
?
@wre232114 Here is my vite.config.ts
import { sveltekit } from "@sveltejs/kit/vite";
import { defineConfig } from "vite";
export default defineConfig({
plugins: [sveltekit()],
});
With Vite it is working fine.
Here is app.html
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="%sveltekit.assets%/favicon.png" />
<meta name="viewport" content="width=device-width" />
<!-- Google font -->
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link
href="https://fonts.googleapis.com/css2?family=Inter:wght@100..900&display=swap"
rel="stylesheet"
/>
%sveltekit.head%
</head>
<body data-sveltekit-preload-data="hover">
<div style="display: contents">%sveltekit.body%</div>
</body>
</html>
I checked source code of@sveltejs/kit/vite
, it is not compatible with Farm cause it uses Vite-specific APIs like vite.ssrLoadModules
Any other way of using it in SvelteKit?
No for now, a farm-plugin-sveltekit
is needed, I hope it can be implemented as soon as possible
Why close this issue?
hi @CRT-HAO We have added support for the vite svelte plugin. Do you have any other needs?
I'll reopen this issue, it would be closed when the plugin is compatible or a alternative plugin is provided
Bump. Haven't dug into the code yet. but here is my error:
Caused by: Error: Parse `src/app.html` failed.
Error: Parse `src/app.html` failed.
Error: × Stray end tag "head"
╭─[src/app.html:34:1]
31 │
32 │ <meta name="viewport" content="initial-scale=1.0, width=device-width" />
33 │ %sveltekit.head%
34 │ </head>
· ───────
35 │ <body data-sveltekit-preload-data="hover">
36 │ <!-- <script>
37 │ const ls = localStorage.getItem('sv-darkmode');
╰────
× Start tag "body" seen but an element of the same type was already open
╭─[src/app.html:35:1]
32 │ <meta name="viewport" content="initial-scale=1.0, width=device-width" />
33 │ %sveltekit.head%
34 │ </head>
35 │ <body data-sveltekit-preload-data="hover">
· ──────────────────────────────────────────
36 │ <!-- <script>
37 │ const ls = localStorage.getItem('sv-darkmode');
38 │ const prefers = window.matchMedia('(prefers-color-scheme: dark)').matches;
╰────
× Invalid first character of tag name
╭─[src/app.html:56:1]
53 │ </script> -->
54 │
55 │ <div style="display: contents;max-width: 100vw;">
56 │ %sveltekit.body%<
· ─
57 │ </div>
58 │ </body>
59 │ </html>
╰────
@KyleFontenot you are using sveltekit
with the svelte
only plugin. (%sveltekit.body%
)
As far as I understand there is no way to use farm with sveltekit currently. Any ETA about this? SK is my main framework
It seems that sveltekit plugin is deeply integrated with Vite, We don't have a ETA
Steps to reproduce
Task: Migrate an existing SvelteKit(using Vite) project to Farm.
Run
pnpm add @farmfe/core @farmfe/cli
. Add this code to farm.config.ts.Any additional comments?
No response