Updated 1 August 2023
Vite’s approach is particularly suited for modern web development, where projects often use many smaller modules instead of a single large bundle. By taking advantage of native ES modules and efficient tools, Vite can significantly speed up the development workflow, making it an attractive choice for web developers. There is a detailed explanation in the Why Vite section of the official docs.
npm init
in the package folder.
2 |
npm install vite --save-dev |
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 |
build
script to generate the optimized production build.
1 |
npm run build |
With these steps, you have now set up Vite in a separate package within your Bagisto project. This approach allows you to keep your Vite-related code and assets separate from the core Bagisto codebase, making it easier to manage and maintain your customizations.
Thanks for reading this blog. Please comment below if you have any question. Also you can hire laravel developers for your custom laravel projects. kindly explore our extensions.
If you have more details or questions, you can reply to the received confirmation email.
Back to Home
Be the first to comment.