Problem with Setting up Ziggy Laravel9/Vue3/inertia/vite #565
-
I'm really desperate for help, I cant figure it out on my own. I try to setup Ziggy.js in my app. -> https://github.com/tighten/ziggy First I install ziggy via
After that I Add the @routes Blade directive to my main layout (Don't know if this is necessary) app.blade.php
After that I generate the JS file with Next I create an alias. vite.config.js
Then I add the Import to my main.ts file
And I get the following error
|
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 19 replies
-
Does the Also, your - import route from 'ziggy';
+ import { ZiggyVue } from 'ziggy'; // if this doesn't work, try importing it from `ziggy/dist/vue`
- .use(plugin,Ziggy)
+ .use(ZiggyVue, Ziggy) Take a look at the docs for using the Vue plugin. |
Beta Was this translation helpful? Give feedback.
-
hii, `app.js import { createApp, h } from "vue"; const appName = createInertiaApp({ `package.json:
`vite.config.js: export default defineConfig({ Any Help please |
Beta Was this translation helpful? Give feedback.
-
Company I work for made this to streamline our use of Inertia with named routes, MIT and thought it might be useful to some of you all. Gets you up and running with named routes in Inertia/Vue3 with around 4 lines of code, no @routes directive, exported JS files or API routes setup needed. |
Beta Was this translation helpful? Give feedback.
Does the
ziggy.js
file exist right beside yourmain.ts
? If it does, does importing it as'./ziggy.js'
(including file extension) work?Also, your
.use()
for the Vue plugin should have Ziggy's Vue plugin as its first argument, not the route function.Take a look at the docs for using the Vue plugin.