-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add suport to Vite #1308
Add suport to Vite #1308
Conversation
Related issue |
Thanks for your contribution @ruanpepe , give me some time to review this, could you provide further information about next changes:
My doubt is why the already included shorthand check for $( document ).ready() of JQuery won't work for the VITE support you included. |
jQuery is included in my app.js and Vite loads the js files asynchronously. I have tried the $( document ).ready() but i had a lot of work solving |
Oh, I see. I have read next link about the problem you faced: https://laracasts.com/discuss/channels/vite/laravel-vite-jquery Can you try the fix proposed by user: |
Using 'vite' and 'mix', it woks. Using 'vite_spa', the css is being loaded after js. Because it, the raw content of page becomes visible for a short moment. |
@ruanpepe OK, the problem you faced with your new In the next days, I will give these changes a test on some of my projects, just to check everything still works. Note I do not use Mix or Vite, so testing with Mix and Vite is up to you. Finally, thanks for all your work here! |
Great! It's a great pleasure contribute to this project i use for so long and for free. And it's a great experience to be in touch with another dev in another language. Thank you. |
I did some research about flashing unstyled content in Vite, and after some testing using 'vite_spa' I noticed that this only happens in dev mode (npm run dev). In prod (npm run build) it is not an issue. |
@ruanpepe Good, you can add that option again if you like, and then we may add a warning on the Wiki for the flash of unstyled content issue when working in dev mode. However I'm not sure if
|
Nice! |
@ruanpepe I reverted some style fixes added by your editor, updated the config docs, and joined |
Everything is ok |
@ruanpepe Great, I have update Wiki docs to address these changes, please review it, any suggestion would be accepted. https://github.com/jeroennoten/Laravel-AdminLTE/wiki/Other-Configuration |
There are two Laravel Mix sections (1, 2). I think the second one would be Laravel Vite, right? |
Thanks for pointing this! Fixed now! |
@ruanpepe The When you submit a form, most of the form components have a I know I can fix this by adding |
I hadn't noticed this behavior. |
@ruanpepe Ok, I will try to investigate further. Anyway, doesn't Vite always load the Maybe other solution may be to include Also, can you try solutions that require extra configuration with VITE, for example: My ideal goal would be to remove the added |
I'm going to test it, and tomorrow i will let you know the results. |
What's in this PR?
In config:
I changed the Laravel Mix config lines to a new patter that can be used with Vite
In that new way, the user can choose between 'mix', 'vite' and false.
In master.blade.php:
I included a switch to include the css and js files according to the config.
It is checking if the user is using the old mix config, so it is not a breaking change.
In components
I included a check to prevent scripts from running before jQuery loading finish.
The wiki must be updated
https://github.com/jeroennoten/Laravel-AdminLTE/wiki/Menu-Configuration
My tests included
Further tests are recommended
Checklist