Repository navigation
Move the asset build from Laravel Mix to Vite - #562
Merged
Merged
Conversation
Vite 8 with laravel-vite-plugin replaces Laravel Mix and webpack. The bundles are ES modules: jQuery and the libraries the pages use are set as globals first, jQuery UI comes from its prebuilt bundle, jqGrid and the multiselect widget are registered explicitly, implicit globals are assigned to window, and inline scripts that use them at load time are modules after deferred CDN plugins. Blade views use @Vite, static images move to public/images, and each release keeps its own public/build. The deploy builds with yarn build and VITE_REVERB_* and clears the response cache after the symlink switch. Takes the Dependabot JavaScript updates: laravel-echo 2, axios 1.20, pusher-js 8.6 and minor versions, bootbox from npm, and drops the unused Tailwind, cross-env, Alpine and CodeMirror packages.
This was referenced Oct 12, 2026
contributors/fsu.png, flmnh.png and uf.png, icons/apple-icon.png and apple-icon-precomposed.png, and avatars/small/missing.png aren't referenced by live code. The unused missing_avatar_small config key goes too.
This was referenced Oct 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Moves the asset build from Laravel Mix (webpack) to Vite, and takes the open Dependabot JavaScript updates with it. Part of #521 (its Vite and
laravel-echoitems; dropping Bootstrap and jQuery stays open). Replaces Dependabot #552–#561.Packages
laravel-mix,webpack,sass-loader,resolve-url-loader, and the unusedtailwindcss,@tailwindcss/forms,cross-env,alpinejsandcodemirror(nothing imported or configured them; Livewire ships its own Alpine).vite8.3,laravel-vite-plugin3.2, andbootbox5.5.3 from npm instead of the vendored minified 5.0.0 copy.laravel-echo1.19 → 2.6.1,axios1.12 → 1.20,pusher-js8.4 → 8.6, plussass,postcss,autoprefixer,jquery-uiand the other minor versions from Bump the javascript-minor-and-patch group with 9 updates #552.main.package.jsonscripts are nowyarn dev(Vite dev server) andyarn build(production build intopublic/build).JavaScript
The bundles are now ES modules, which run after the page is parsed and in strict mode. Changes that keep the old behaviour:
jquery-global.jssetswindow.$/window.jQuery, andadmin-globals.js/front-globals.jssetClipboardJS,bootstrap,bootboxandConfettiGenerator. They're imported before the plugins and page scripts, since imports run in order.require()→import, and the Reverb settings move fromprocess.env.MIX_REVERB_*toimport.meta.env.VITE_REVERB_*.jquery-ui/dist/jquery-ui.js. The individual widget files only load their dependencies through AMD, which webpack supported and Vite doesn't.jqgrid-setup.jscalls it with the global jQuery.ui.multiselect.js(a modified copy that addsdata-selected-value): its UMD wrapper is replaced by a direct call, so it registers the same way in dev and in the build.notify,initializeClock,getTimeRemaining,clockDiv(common.js) andmakeSelect,formPost,formPostWithModalClose,toggleGeoLocateCommunityForm,checkDuplicates,checkRequiredValues,renumber_geolocate(admin-modals.js) are now assigned towindow; in strict mode the bare assignments would throw.amChartBingo.js's$body/timeoutbecame locals.admin-modals.jsimportsGroupInviteManageritself. The modal body arrives through jQuery'sload(), and a module script inside it would run after the load callback that initializes the manager.jquery.form.min.js(nothing callsajaxForm/ajaxSubmit).Blade
mix(...)and the sixasset('js/amChart*.min.js')tags become@vite(...).ConfettiGeneratorwhile the page loads aretype="module", and the DataTables CDN scripts before them aredefer, so they run after the bundles in the same order as before: admin and frontbingo/show, adminevent/show,group/show,project/statistics, frontbingo/cardandwedigbio/index. Thelivewire:initlisteners (event, expedition and project pages) stay classic scripts, so they register before Livewire fires the event.~prefix.Images
resources/imagesmoves topublic/imagesand is tracked in git, replacing Mix's copy step. Nothing writes topublic/imagesat runtime; uploads are instorage/app/public.Six of the 61 images aren't used anywhere, so they move to
resources/unused/public/images/(same folders) instead, leaving 55 inpublic/images:contributors/fsu.png: not referenced (the site usesfsu-logo.svg).contributors/flmnh.pngandcontributors/uf.png: only in commented-out markup infront/layout/contributors.blade.php.icons/apple-icon.pngandicons/apple-icon-precomposed.png: not referenced (devices only look for/apple-touch-icon.pngat the site root).avatars/small/missing.png: only named by themissing_avatar_smallconfig key, which nothing reads; the key is removed.Deploy
deploy-environment.yml):yarn buildwithVITE_REVERB_*from the same GitHub variables, and the package step checks thatpublic/build/manifest.jsonexists instead of copying Mix's folders.deploy.php:public/css,public/js,public/fonts,public/imagesandpublic/mix-manifest.jsonare no longer shared, so each release keeps its own build and a rollback gets the assets it was built with. Filament publishes its own files intopublic/css,public/jsandpublic/fontson every deploy (artisan:filament:assets).artisan:responsecache:clearafterdeploy:publish. Cached pages name the build's hashed files, which only exist in the release that built them; the existingcache:clearruns before the symlink switch, so pages cached by the old release in between would point at files the new release doesn't have.Other
TestCaseuseswithoutVite()instead ofwithoutMix().env.exampleusesVITE_REVERB_*. Local.envfiles need the same rename (MIX_REVERB_*→VITE_REVERB_*)..gitignore:/public/buildand/public/hotinstead of/public/imagesand/public/mix-manifest.json..ai/guidelines/frontend.md,CLAUDE.md,AGENTS.md,docs/architecture.md,docs/operations.md) describe Vite.Tested locally (biospex.test, production build)
yarn buildsucceeds (about 2 s).php artisan test --compact: 629 passed, with no build present, as in CI. Pint passes.Not tested locally: the reconcile page (no expedition with reconcile data locally) and
yarn devagainsthttps://biospex.test.To verify on development
See #548.