Replace Laravel Mix with Vite #714
kresnasatya
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I was curious how to replace Laravel Mix with Vite in Jigsaw because Vite become the modern tool to integrate frontend assets and backend (e.g. TailwindCSS). I check in this issue: #640 but no luck find the way. Luckily I find a reference to use Vite in Jigsaw: https://github.com/jasara/jigsaw-vite-vue-tailwind-template. In this discussion, I would like to give a brief steps how to replace Laravel Mix with Vite in Jigsaw.
vite.config.js
file and code below. In short, this code create a plugin function namejigsaw()
. This function acts as executor and watcher for files inside Jigsaw's project. If any file inside Jigsaw's project change then the watcher will trigger full-reload.config.php
addviteUrl
andviteClientUrl
keys.postcss.config.js
file. In my opinion and intuition, this is necessary because Vite integrates with postcss. You just need to install postcss + postcss.config.js in order to make integration works. Link: https://vitejs.dev/config/shared-options#css-postcss<head>
tag in order to make full reload works. I usesource/_layouts/main.blade.php
as a root view.scripts
inside package.json file. We set type module because we use ES6 import module invite.config.js
file.That's it! Try to run
npm run dev
andvendor/bin/jigsaw serve
in each terminal. Then, open your browser, edit a thing inside a file. Have fun! Thanks.Here's the full commit to see how to replace Laravel Mix with Vite in Jigsaw: phpbali-org/phpbali-org.github.io@1f20e7f
Beta Was this translation helpful? Give feedback.
All reactions