simple-vite-laravel maintained by guihigashi
Description
A Blade directive for Vite/React assets
Author
Last update
2022/04/09 02:24
(dev-main)
License
Downloads
24
A Blade directive for Vite/React assets
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