Just created new project, added laravel ui with auth.
Ran: npm i then npm run dev
npm run dev
> dev
> vite
VITE v4.1.1 ready in 11369 ms
➜ Local: http://localhost:5173/
➜ Network: use --host to expose
➜ press h to show help
LARAVEL v10.0.0 plugin v0.7.4
➜ APP_URL: http://localhost
The following dependencies are imported but could not be resolved:
lodash (imported by C:/Lara Projects/base_auth/resources/js/bootstrap.js)
Are they installed?
what am i missing here... I see Laravel 10 now comes with Vite (not MIX) -- i have read the docs on Laravel site but no solution suggested.
@Sinnbeck
So Something like this... uncommented the 1st 2 lines
//import _ from 'lodash';
//window._ = _;
import 'bootstrap';
/**
* We'll load the axios HTTP library which allows us to easily issue requests
* to our Laravel back-end. This library automatically handles sending the
* CSRF token as a header based on the value of the "XSRF" token cookie.
*/
import axios from 'axios';
window.axios = axios;
window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
@aifx4intel No need to? Vite is awesome and I would continue to use it if I were you. It just works a bit different. Instead of compiling files when running "dev" it just runs a dev server that pushes the asserts to the browser.
@aifx4intel The thing with vite is the speed. When using mix my app took 1-2 seconds to recompile on any change. With vite its instant and dont need to reload the page.
thanks. I hear you.... so how do i resolve this error to include Vite? I uncommented the lodash in resources/js/bootstrap.js
//import _ from 'lodash';
//window._ = _;
import 'bootstrap';
/**
* We'll load the axios HTTP library which allows us to easily issue requests
* to our Laravel back-end. This library automatically handles sending the
* CSRF token as a header based on the value of the "XSRF" token cookie.
*/
import axios from 'axios';
window.axios = axios;
window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
yet when i try to register a user i get:
Vite manifest not found at: C:\Lara Projects\base_auth\public\build/manifest.json
when i run npm run dev as suggested it just hangs there...
@aifx4intel Yes it "hangs" as its a server. Its like running php artisan serve. You leave it "hanging" while developing and hit "ctrl+c" when you are done for the day.
But to fix the manifest error you just run npm run build
@aifx4intel Happy to help :) I know its a bit confusing, but once you get it, its really great. You might want to end each day by running "npm run build" to compile the assets in case you forget to start the dev server the next time you want to work on pure php
@aifx4intel Exactly. But be aware that the /public/build folder is in .gitignore so if you plan to build locally and push the assets to production, be sure to remove it from there :) (if you use git)
It seems vite.php has been removed from Laravel 10, It used to come with Laravel 9
Will it create any issue if I manually paste the vite.php and use it?