Product
Introducing License Enforcement in Socket
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
laravel-vite-plugin
Advanced tools
The laravel-vite-plugin npm package is designed to integrate Vite with Laravel applications. It provides a seamless way to manage and build frontend assets using Vite's fast and modern build tool, while leveraging Laravel's backend capabilities.
Vite Configuration
This feature allows you to configure Vite to work with Laravel. The code sample shows how to define the Vite configuration and use the laravel-vite-plugin to specify the input files and enable hot module replacement.
```javascript
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,
}),
],
});
```
Hot Module Replacement (HMR)
This feature enables Hot Module Replacement (HMR) for a better development experience. The code sample shows how to configure the Vite server to use HMR with the laravel-vite-plugin.
```javascript
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,
}),
],
server: {
hmr: {
host: 'localhost',
},
},
});
```
Asset Versioning
This feature allows for asset versioning, which helps in cache busting. The code sample shows how to enable the generation of a manifest file during the build process, which can be used for versioning assets.
```javascript
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,
}),
],
build: {
manifest: true,
},
});
```
vite-plugin-laravel is another package that integrates Vite with Laravel. It offers similar functionalities such as asset management and HMR. However, it may have different configuration options and community support compared to laravel-vite-plugin.
laravel-mix is a popular package for managing assets in Laravel applications. While it is not specifically designed for Vite, it provides a comprehensive API for defining Webpack build steps for your Laravel application. It is more mature and has a larger community compared to laravel-vite-plugin.
Vite is a modern frontend build tool that provides an extremely fast development environment and bundles your code for production.
This plugin configures Vite for use with a Laravel backend server.
Documentation for the Laravel Vite plugin can be found on the Laravel website.
Thank you for considering contributing to the Laravel Vite plugin! The contribution guide can be found in the Laravel documentation.
In order to ensure that the Laravel community is welcoming to all, please review and abide by the Code of Conduct.
Please review our security policy on how to report security vulnerabilities.
The Laravel Vite plugin is open-sourced software licensed under the MIT license.
v1.0.5 - 2024-07-09
FAQs
Laravel plugin for Vite.
The npm package laravel-vite-plugin receives a total of 254,693 weekly downloads. As such, laravel-vite-plugin popularity was classified as popular.
We found that laravel-vite-plugin demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
Product
We're launching a new set of license analysis and compliance features for analyzing, managing, and complying with licenses across a range of supported languages and ecosystems.
Product
We're excited to introduce Socket Optimize, a powerful CLI command to secure open source dependencies with tested, optimized package overrides.