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.

Configuration "resources/js/app.js" does not exist.

See original GitHub issue
  • Laravel Vite Plugin Version: 0.2.0
  • Laravel Version: 9.19.0
  • Node Version: 18.4.0
  • NPM Version: 8.12.1
  • Inertia Version: 0.6.3

Description:

Upon running npm run dev Laravel throws:

Configuration "resources/js/app.js" does not exist.

Steps To Reproduce:

  1. Follow the official Laravel docs
  2. Replace ‘mix’ directive with ‘vite’ directive in app.blade.php

Went so far as to make changes in the vite.config file with no success. Also used an absolute URL for the resources and error persists.

Dumped composer and cleared Laravel and browser cache with no success.

There is a post on Stackoverflow with a similar issue: https://stackoverflow.com/questions/72799267/why-laravel-vite-directive-not-working-in-my-project

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:25 (11 by maintainers)

github_iconTop GitHub Comments

7reactions
timacdonaldcommented, Jul 6, 2022

Thank you for sharing these. I can now see the issue you are facing.

You currently have the community Vite plugin and the Laravel plugin active, and they are conflicting with each other.

The PHP package "innocenzi/laravel-vite" along with the NPM package "vite-plugin-laravel" are part of the fantastic community Vite plugin.

This is a great plugin that has many features and you may wish to continue using it. If you do want to use the community plugin, I recommend uninstalling the "laravel-vite-plugin" NPM package.

Then you should refer to the documentation: https://laravel-vite.dev/

Alternatively, if you would like to use framework version, you should uninstall the "innocenzi/laravel-vite" composer package and additionally uninstall the "vite-plugin-laravel" NPM package.

Ensure that you have only followed the steps in the official upgrade guide.

Finally, if you are still having issues, you may need to run:

php artisan view:clear

to bust the view cache. I hope that gets you back on track.

1reaction
ThisIsPuzzlecommented, Nov 10, 2022

Hehe, i just got the error on the developement project - same code as the one on production , which was live for a few months now - and i couldn’t understand why.

After i made the upgrade from webpack to vite, i forgot to delete the generated views from blade ( php artisan view:clear ) which was using the app.js from public folder…

The @vite() accepts as a paramter the config name from configs/vite.php file - so it is not correct to use @vite('resources/js/app.js') ( laravel mix was using the path of the files… ) but instead use @vite('default') or just @vite() - since in the code of Innocenzi / Vite you will find this line: $name ??= config('vite.default'); - so if you don’t set a name it will get the vite.default confing by default.

So when you migrate from webpack to vite on InertiaJS - just clear your views generate by laravel ( php artisan view:clear - or manually delete the storage/framework/views folder )

Read more comments on GitHub >

github_iconTop Results From Across the Web

Laravel Vite - Configuration does not exist - Stack Overflow
But the problem occurred when I tried to access the resource and it says Configuration "resources/js/app.js" does not exist.
Read more >
Unable to locate file in Vite manifest: resources/css/app.css
config.js file has "resources/sass/app.scss". My resources/css/app.css file is currently empty as it's a new project ...
Read more >
Asset Bundling (Vite) - The PHP Framework For Web Artisans
Vite is configured via a vite.config.js file in the root of your project. You are free to customize this file based on your...
Read more >
Configuration with app.json / app.config.js
Configuration with app.json/app.config.js. Learn about what is Expo config and how you can dynamically use it by customizing it.
Read more >
Module Federation - webpack
js, etc. Relative and absolute request in shared: Will always be provided, even if not used. Will resolve relative to config.context ...
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