question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Vue setup: Can't resolve 'ziggy' in '[project path]\resources\js\pages'

See original GitHub issue

Description

I’ve tried to set up ziggy in my Laravel/Vue MPA project, following the instructions for javascript frameworks and vue. I ran php artisan ziggy:generate and set it up in my javascript file like show in the instructions, with a Vue mixin. The issue is the following line: import route from 'ziggy'; When I build with yarn watch, I get this error: ERROR in ./resources/js/pages/welcome.js Module not found: Error: Can't resolve 'ziggy' in '[my project path]\resources\js\pages' @ ./resources/js/pages/welcome.js 6:0-27 12:13-19 @ multi ./resources/js/pages/welcome.js ./resources/css/app.css

I’m probably missing something, do I have to install a seperate npm package, or where do I get this module from? I found nothing in the documentation.

Expected behavior

Not getting an error, probably.

Environment

  • Laravel version: 8.16.1
  • Ziggy version:  1.0.3

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6

github_iconTop GitHub Comments

1reaction
Chinyoka1commented, Nov 30, 2020

Ohhh, I see. I learned about ziggy in a thread on Laracasts, and I thought that it does exactly that. Thank you for clarifying.

0reactions
bakerkretzmarcommented, Nov 30, 2020

Take a look at the section of the Readme on setting up Ziggy with Javascript frameworks. With Mix 5 it would look like this:

mix.webpackConfig({
    resolve: {
        alias: {
            ziggy: path.resolve('vendor/tightenco/ziggy/dist'),
        },
    },
});

Like Laravel’s helper, Ziggy’s route() function returns a string, it doesn’t perform any navigation for you. Your goToLogin() method will return something like http://my-app.test/login, whether/how you navigate to that page is up to you.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cannot find module 'ziggy' or its corresponding type ... - GitHub
When using Vue3 and TypeScript, in my app.ts where I try to apply the ZiggyVue plugin using the import statement I get the...
Read more >
An error occurs in ZiggyVue.(Cannot find name 'route')
When developing with laravel9 and typescript, I get a ZiggyVue error when using "route". There is no problem with the operation.
Read more >
I am lost with Ziggy Vue 3 setup - Laracasts
Please i need help in setting up Ziggy Library with Inertia Js Vue 3 and Laravel ... { ZiggyVue } from 'ziggy'; createInertiaApp({...
Read more >
Install Ziggy on Laravel 8 and Vue 3 - Magutti Blog
I've installed Ziggy a package from Tighten. Ziggy provides a JavaScript route() helper function that works like Laravel's, making it easy to ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found