Question About Svelte Support in AdonisJS v7 #5059
Replies: 1 comment
-
|
Svelte is not officially supported as an Inertia adapter in AdonisJS v7 out of the box — the However, the Inertia.js Svelte adapter itself works fine, and you can set it up manually. The AdonisJS Inertia integration is essentially a server-side adapter that sends JSON responses with the right headers — the frontend framework choice is mostly a client-side concern. Here is what you need to do: 1. Install the Svelte Inertia adapter: npm install @inertiajs/svelte2. Set up your Svelte entry point ( import { createInertiaApp } from "@inertiajs/svelte";
createInertiaApp({
resolve: (name) => {
const pages = import.meta.glob("../pages/**/*.svelte", { eager: true });
return pages[`../pages/${name}.svelte`];
},
setup({ el, App, props }) {
new App({ target: el, props });
},
});3. Configure Vite for Svelte ( import { svelte } from "@sveltejs/vite-plugin-svelte";
import adonisjs from "@adonisjs/vite/client";
import { defineConfig } from "vite";
export default defineConfig({
plugins: [svelte(), adonisjs({ entrypoints: ["inertia/app/app.ts"] })],
});4. Update The AdonisJS team may add official Svelte support in a future release — it has been requested multiple times. But the manual setup above should get you going today without waiting for official support. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello AdonisJS team,
First of all, thank you for the great work on AdonisJS v7. We’re currently evaluating the upgrade of our company’s product to version 7, and we’re very excited about the improvements introduced in this release.
While reviewing the adonisrc.ts configuration—specifically the indexPages section—we noticed that the framework option currently supports only "vue3" and "react".
We would like to ask if there are any plans to add official support for Svelte in the future. Is a Svelte port currently being considered or discussed in your roadmap?
Thank you in advance for your time and clarification. We really appreciate the effort the team puts into the framework and look forward to your feedback.
Beta Was this translation helpful? Give feedback.
All reactions