Vite is a new tool for web development that makes projects faster and helps with workflow efficiency.
Modern apps use many small modules instead of a single large bundle.
|
2 |
npm install vite --save-dev |
Step 5: Create Vite Configuration File
Create a Vite configuration file, vite.config.js, in the root of your package directory.
This file will contain the Vite settings and plugins you want to use.
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
import laravel from "laravel-vite-plugin"; import path from "path"; export default defineConfig({ plugins: [ laravel({ hotFile: "../../../public/admin-default-vite.hot", publicDirectory: "../../../public", buildDirectory: "themes/admin/default/build", input: [ "src/Resources/assets/css/app.css", "src/Resources/assets/js/app.js", ], refresh: true, }), ], }); |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 |
{ "private": true, "scripts": { "dev": "vite", "build": "vite build" }, "devDependencies": { "axios": "^1.4.0", "laravel-vite-plugin": "^0.7.2", "postcss": "^8.4.23", "vite": "^4.0.0", }, } |
|
1 |
@vite(['src/Resources/assets/css/app.css', 'src/Resources/assets/js/app.js']) |
|
1 |
npm run dev |
When you are ready for production, run the build script as per the npm documentation.
|
1 |
npm run build |
With these steps, you have successfully set up Vite in a separate package within your Bagisto project.
This approach keeps your Vite related code and assets separate from the core Bagisto codebase.
It makes it easier to manage and maintain your customizations.
