ziggy icon indicating copy to clipboard operation
ziggy copied to clipboard

Config not loaded in vue plugin

Open Lea-Reift opened this issue 4 months ago • 1 comments

Ziggy version

v2.6.0

Laravel version

12.32.5

Description

I recently upgraded Ziggy from 1.8 to 2.6. I tried to test the manual config in vue without the @route tag in the app.blade.php file, but it seems to not load the manual config from the resources/js/ziggy.js file, even when explicitly called in resources/js/app.ts:

import { ZiggyVue } from 'ziggy-js'
import { Ziggy } from './ziggy.js'
...

app.use(plugin) // ignore this plugin
    .use(ZiggyVue, Ziggy)



### Ziggy call and context

```js
const { item, is_permitted = false } = defineProps<{
    item: Menu
    is_permitted?: boolean
}>()

const validateMenuLink = computed(() => {
    const defaults = {
        isActive: false,
        routeLink: route('dashboard'),
        routeName: item?.route ?? ''
    }

    try {
        if (item?.route) {
            defaults.isActive = route().current(item.route)
            defaults.routeLink = route(item.route as keyof RouteList)
        }
    } catch (e) {
        console.warn('Route error:', e)
    }

    return defaults
})

Ziggy configuration

Ziggy
VM153:1 Uncaught ReferenceError: Ziggy is not defined
    at <anonymous>:1:1
(anonymous) @ VM153:1
window.Ziggy
undefined

Route definition

Not relevant

Lea-Reift avatar Oct 04 '25 05:10 Lea-Reift

Can you share more context about where/when that error happens, and any other output you see? Is it during build or when the page loads?

bakerkretzmar avatar Oct 04 '25 21:10 bakerkretzmar