diff --git a/stubs/inertia/resources/js/app.js b/stubs/inertia/resources/js/app.js index e4d15699e..1db62258b 100644 --- a/stubs/inertia/resources/js/app.js +++ b/stubs/inertia/resources/js/app.js @@ -3,6 +3,7 @@ import './bootstrap'; import { createApp, h } from 'vue'; import { createInertiaApp } from '@inertiajs/inertia-vue3'; import { InertiaProgress } from '@inertiajs/progress'; +import { ZiggyVue } from 'ziggy'; const appName = window.document.getElementsByTagName('title')[0]?.innerText || 'Laravel'; @@ -12,7 +13,7 @@ createInertiaApp({ setup({ el, app, props, plugin }) { return createApp({ render: () => h(app, props) }) .use(plugin) - .mixin({ methods: { route } }) + .use(ZiggyVue, Ziggy) .mount(el); }, }); diff --git a/stubs/inertia/resources/js/ssr.js b/stubs/inertia/resources/js/ssr.js index 59b904cf9..bb4a4cbe3 100644 --- a/stubs/inertia/resources/js/ssr.js +++ b/stubs/inertia/resources/js/ssr.js @@ -2,7 +2,7 @@ import { createSSRApp, h } from 'vue'; import { renderToString } from '@vue/server-renderer'; import { createInertiaApp } from '@inertiajs/inertia-vue3'; import createServer from '@inertiajs/server'; -import route from 'ziggy'; +import { ZiggyVue } from 'ziggy'; const appName = 'Laravel'; @@ -15,15 +15,9 @@ createServer((page) => setup({ app, props, plugin }) { return createSSRApp({ render: () => h(app, props) }) .use(plugin) - .mixin({ - methods: { - route: (name, params, absolute) => { - return route(name, params, absolute, { - ...page.props.ziggy, - location: new URL(page.props.ziggy.url), - }); - }, - }, + .use(ZiggyVue, { + ...page.props.ziggy, + location: new URL(page.props.ziggy.url), }); }, }) diff --git a/stubs/inertia/webpack.mix.js b/stubs/inertia/webpack.mix.js index 4cb57bf22..cb4f65b36 100644 --- a/stubs/inertia/webpack.mix.js +++ b/stubs/inertia/webpack.mix.js @@ -17,6 +17,7 @@ mix.js('resources/js/app.js', 'public/js').vue() ]) .alias({ '@': 'resources/js', + ziggy: "vendor/tightenco/ziggy/dist/vue", }); if (mix.inProduction()) { diff --git a/stubs/inertia/webpack.ssr.mix.js b/stubs/inertia/webpack.ssr.mix.js index 6dfaae611..36be2a204 100644 --- a/stubs/inertia/webpack.ssr.mix.js +++ b/stubs/inertia/webpack.ssr.mix.js @@ -9,7 +9,7 @@ mix.js('resources/js/ssr.js', 'public/js') }) .alias({ '@': 'resources/js', - ziggy: 'vendor/tightenco/ziggy/dist/index', + ziggy: 'vendor/tightenco/ziggy/dist/vue', }) .webpackConfig({ target: 'node',