This project was created for Vite 1 and an old version of Laravel, it's probably not relevant or even working and I don't have the time to maintain it currently. I recommend checking out Laravel Vite if you need to get Vite working with Laravel.
If on windows, run from administrative powershell:
php artisan vite:link
This creates a symbolic link of your resources folder to vite/resources
yarn
yarn watch (for dev)
yarn build (for production builds)
Copy the /vite folder into your project.
Run: yarn add -D @vue/compiler-sfc vite and yarn add vue@next
Update your scripts in package.json:
"scripts": {
"watch": "cd vite && npx vite",
"build": "cd vite && npx vite build --entry=\"../resources/js/app.js\""
},If your main js file isn't resources/js/app.js, update the path both in the build script above and in vite/vite.config.js.
Add the following to your layout blade file:
@if(env('APP_ENV') === 'production')
@if(isset($manifest['style.css']))
<link rel="stylesheet" href="/assets/{{ $manifest['style.css'] }}">
@endif
@if(isset($manifest['index.js']))
<script type="module" src="/assets/{{ $manifest['index.js'] }}"></script>
@endif
@else
<script type="module" src="http://localhost:3000/vite/client"></script>
<script type="module" src="http://localhost:3000/resources/js/app.js"></script>
@endifAdd the following to your AppServiceProvider's boot method.
View::share('manifest', json_decode(file_get_contents(public_path('assets/manifest.json')), true));