skip to Main Content

I’m working on a project using Laravel with React and Inertia.js. After making changes to my components and routes, I’m unable to see them reflected in the browser. I’ve run the following commands to clear the caches:

php artisan view:clear

php artisan cache:clear

php artisan route:clear

php artisan config:clear

Despite these actions, the updates are still not showing. I’ve confirmed that I’m in development mode and there are no error messages in the console. I’ve also tried refreshing the page and clearing the browser cache. Is there something I might be overlooking or additional steps I should try to resolve this issue? Any guidance or suggestions would be greatly appreciated!

2

Answers


  1. if you run php artisan route:list, and your new routes are there, you should check if your routes are inside the middleware auth and you are not identified.

    If you get a 404 error then your routes are probably not included in routes/web.php.

    Login or Signup to reply.
  2. Your frontend must be re-compiled every time you change any js (.js/.ts/.jsx/.tsx) file, or css file.

    In local development, assuming you are using one of Laravel’s starter packs on its latest versions, your package.json file should have dev and build as scripts property. If so, you should run the following command:

    npm run dev
    

    This will compile your JS code, and then will continue its execution in order to watch for changes in your files, so that once anything changes, it’ll quickly re-compile that change, and perform a hot module replacement in your browser, so that you don’t even need to reload the web page in order to see changes. Be sure to always have this command running whenever you’re developing.

    To deploy your app in an external environment, such as production, you’d instead run:

    npm run build
    

    Which will compile your app in production-mode once, and won’t watch for changes.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search