Vite plugin Symfony
A Vite plugin to integrate easily Vite in your Symfony application..
- create a
entrypoints.json
file inside your build directory with your js/css/preload dependencies. - reload your browser when you update your twig files
This package is intended for use with the Symfony Bundle : pentatrion/vite-bundle.
Installation
npm i vite-plugin-symfony
Create this directory structure :
├──assets
│ ├──app.js
│ ├──app.css
│...
├──public
├──composer.json
├──package.json
├──vite.config.js
Vite base config with vite 3.x
import {defineConfig} from "vite";
import symfonyPlugin from "vite-plugin-symfony";
export default defineConfig({
plugins: [
symfonyPlugin(),
],
build: {
rollupOptions: {
input: {
app: "./assets/app.js"
},
},
}
});
and your package.json :
{
"scripts": {
"dev": "vite",
"build": "vite build"
},
"devDependencies": {
"vite": "^4.0",
"vite-plugin-symfony": "^3"
}
}
Read the Docs to Learn More.
Ecosystem
License
MIT.