guihigashi / simple-vite-laravel
A Blade directive for Vite/React assets
Installs: 24
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 1
Open Issues: 0
pkg:composer/guihigashi/simple-vite-laravel
Requires
- php: ^8.0.2
- ext-json: *
- illuminate/support: ^9.0
README
Installation
You can install the package via composer:
composer require guihigashi/simple-vite-laravel
Usage
Include @simple_vite in your app.blade.html to inject <script> and <link>
tags based on the value of APP_ENV (production or else).
If you use php artisan serve --host=0.0.0.0, also use yarn dev --host.
The defaults are based on this vite.config.ts:
import react from "@vitejs/plugin-react" import { defineConfig } from "vite" export default defineConfig(({ command }) => ({ base: command === "serve" ? "" : "/dist/", publicDir: false, build: { manifest: true, outDir: "public/dist", polyfillModulePreload: false, rollupOptions: { input: "resources/scripts/main.tsx", }, }, plugins: [react()], }))
If you want to change defaults:
php artisan vendor:publish --tag=simple-vite