agentsclimarketplace

Laravel vite

Skill fusengine/agents/plugins/laravel-expert/skills/laravel-vite

Complete Vite bundling for Laravel - assets, HMR, SSR, frameworks, optimization. Use when configuring frontend build pipeline.From its SKILL.md

Install
npx -y skills add fusengine/agents --skill laravel-vite

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • 22 stars22 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

SKILL.md

5.3 KB, ~1.2k tokens by cl100k_base, as published. Nobody here has run it

Laravel Vite

Agent Workflow (MANDATORY)

Before ANY implementation, use TeamCreate to spawn 3 agents:

  1. fuse-ai-pilot:explore-codebase - Check existing vite.config.js, package.json
  2. fuse-ai-pilot:research-expert - Verify latest Vite docs via Context7
  3. mcp__context7__query-docs - Query specific patterns (SSR, Inertia)

After implementation, run fuse-ai-pilot:sniper for validation.


Overview

Vite is Laravel's default frontend build tool. It provides fast HMR in development and optimized builds for production.

FeaturePurpose
HMRInstant updates during development
BundlingOptimized production assets
SSRServer-side rendering support
FrameworksVue, React, Svelte integration

Critical Rules

  1. Always use laravel-vite-plugin - Never raw Vite config
  2. VITE_ prefix for env vars - Only exposed to frontend
  3. Use @vite directive - Not manual script tags
  4. Build before deploy - npm run build in CI/CD
  5. Configure HMR for Docker - Set server.host: '0.0.0.0'

Decision Guide

Stack Selection

Using Tailwind CSS?
├── YES → v4? @tailwindcss/vite plugin
│         v3? PostCSS config
└── NO → Just laravel-vite-plugin

Using JavaScript framework?
├── Vue → @vitejs/plugin-vue
├── React → @vitejs/plugin-react
├── Svelte → @sveltejs/vite-plugin-svelte
└── None → Plain JS/CSS only

SSR Decision

Need SEO/fast first paint?
├── YES → Using Inertia?
│   ├── YES → Inertia SSR
│   └── NO → Consider Inertia or Livewire
└── NO → Client-side only

Reference Guide

Concepts (WHY & Architecture)

TopicReferenceWhen to Consult
Setupsetup.mdInitial configuration
Entry Pointsentry-points.mdMultiple bundles
Preprocessorspreprocessors.mdSass, Less, PostCSS
Assetsassets.mdImages, fonts, static
Environmentenvironment.mdVITE_ variables
Dev Serverdev-server.mdHMR, Docker, HTTPS
Buildbuild-optimization.mdChunks, minification
SSRssr.mdServer-side rendering
Inertiainertia.mdSPA without API
Frameworksframeworks.mdVue, React, Svelte
Securitysecurity.mdCSP nonce
Deploymentdeployment.mdProduction, CDN

Templates (Complete Code)

TemplateWhen to Use
ViteConfig.js.mdStandard setup
ViteConfigAdvanced.js.mdFull optimization
InertiaSetup.mdInertia + Vue/React
SSRSetup.mdSSR configuration

Quick Reference

Basic Setup

// vite.config.js
import { defineConfig } from 'vite';
import laravel from 'laravel-vite-plugin';

export default defineConfig({
    plugins: [
        laravel({
            input: ['resources/css/app.css', 'resources/js/app.js'],
            refresh: true,
        }),
    ],
});

Blade Directive

<!DOCTYPE html>
<head>
    @vite(['resources/css/app.css', 'resources/js/app.js'])
</head>

Commands

CommandPurpose
npm run devStart dev server
npm run buildProduction build
npm run previewPreview build

Best Practices

DO

  • Use refresh: true for Blade HMR
  • Configure aliases for clean imports
  • Split vendors into separate chunks
  • Use VITE_ prefix for frontend env vars
  • Test Docker/Sail config locally

DON'T

  • Expose sensitive data via VITE_ vars
  • Forget to build before deploying
  • Use absolute paths for assets
  • Skip source maps in staging
  • Ignore chunk size warnings

Laravel 13 Notes

laravel/vite-plugin reste compatible Laravel 13 + Vite 6. Adaptations :

  • Le helper @vite() Blade fonctionne sans changement
  • Pour Inertia 2 + React 19 : utiliser le preset @vitejs/plugin-react v4+
  • HMR via WebSocket : Reverb 1.4 et Vite peuvent cohabiter sur des ports distincts en dev
  • Build production : ajouter build.target: 'es2023' pour profiter de PHP 8.3 côté serveur

What ships with it: 16 files

52.8 KB alongside SKILL.md

Keep looking

Skills are one crate of 325,949. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.