diff --git a/resources/js/app.ts b/resources/js/app.ts index e69de29bb..415492671 100644 --- a/resources/js/app.ts +++ b/resources/js/app.ts @@ -0,0 +1,12 @@ +import '../css/app.css' + +import { createInertiaApp } from '@inertiajs/svelte' +import { resolvePageComponent } from 'laravel-vite-plugin/inertia-helpers' +import { mount, type Component } from 'svelte' + +createInertiaApp({ + resolve: (name: string) => resolvePageComponent(`./pages/${name}.svelte`, import.meta.glob('./pages/**/*.svelte')), + setup({ el, App, props }: { el: HTMLElement; App: Component; props: Record }) { + mount(App, { target: el, props }) + } +}) diff --git a/resources/views/app.blade.php b/resources/views/app.blade.php index bb161891d..0d557c78f 100644 --- a/resources/views/app.blade.php +++ b/resources/views/app.blade.php @@ -1,16 +1,12 @@ - - - - - - - - Coolify - @vite('resources/css/app.css') - - - -

Simple Heading

- - + + + + + + @vite('resources/js/app.ts') + @inertiaHead + + + @inertia + diff --git a/vite.config.ts b/vite.config.ts index 4cac85e3a..b3c48fe05 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -6,7 +6,7 @@ import tailwindcss from '@tailwindcss/vite'; export default defineConfig({ plugins: [ laravel({ - input: ['resources/js/app.js', 'resources/css/app.css'], + input: ['resources/js/app.ts'], refresh: true, }), svelte({