components/jquery
Shim repository packaging jQuery for multiple managers. Install via Composer as components/jquery (also available on Bower, Component, and spm) to include the popular jQuery JavaScript library in your project with standardized versioning and distribution.
fetch(), IntersectionObserver) or modern frameworks (Alpine.js, HTMX, Livewire).Breaking Changes in jQuery 4.0.0:
.bind(), .unbind(), .delegate(), .undelegate(), .live(), .die() (replaced by event delegation via .on())..browser global removed (use feature detection libraries like Modernizr instead)..datepicker(), .dialog()), requiring standalone jQuery UI 4.0.0..ajax() and .getJSON() now return Promises by default (may break callback-based legacy code).$ globally by default, increasing conflict risk with frameworks like Vue/React (requires jQuery.noConflict()).Laravel Stack Impact:
.live() for dynamic elements). Requires audit and refactoring.npm install jquery@4.0.0, but requires webpack aliasing to avoid conflicts:
mix.webpackConfig({
resolve: {
alias: {
jquery: path.resolve(__dirname, 'node_modules/jquery/dist/jquery.js'),
},
},
});
@vitejs/plugin-basic-ssl) and CDN fallback for legacy support. Test with:
import { defineConfig } from 'vite';
import jquery from 'jquery';
export default defineConfig({
plugins: [jquery()],
});
$ conflicts with Alpine.js (Livewire’s default) or React/Vue’s $ (Inertia). Use jQuery.noConflict() and wrap usage:
(function($) {
// jQuery 4.0.0 code here
})(jQuery);
.live('click', ...) with:
$(document).on('click', 'selector', function() { ... });
.ajax() calls to use Promises:
$.ajax(url).then(response => { ... }).catch(error => { ... });
grep -r "\.live\|\.bind\|jQuery.browser" in codebase.).live() or .delegate()? These must be rewritten.| Laravel Component | jQuery 4.0.0 Integration Fit | Recommendation |
|---|---|---|
| Blade Templates | High Risk: Deprecated methods (e.g., .live()) will break. Requires manual refactoring. |
Use CDN for temporary legacy support; audit and replace deprecated methods. |
| Laravel Mix (Webpack) | Medium: Supports jQuery 4.0.0 but requires webpack aliasing and conflict resolution. | Install via npm, configure resolve.alias, and test with mix.js. |
| Vite | Low: Needs plugin setup and may conflict with modern JS. | Prefer CDN to avoid build complexity; use jQuery.noConflict() in app code. |
| Livewire | Very Low: Conflicts with Alpine.js and adds unnecessary weight. | Avoid. Use Alpine.js or vanilla JS for interactivity. |
| Inertia.js (React/Vue) | None: jQuery 4.0.0’s $ conflicts with framework reactivity. |
Do not use. Replace with framework-native solutions (e.g., Axios for AJAX). |
| API-First Apps | None: jQuery is frontend-only. | Irrelevant; focus on Laravel’s backend features (e.g., Sanctum, API resources). |
.live, .bind, .browser).grep -r "\.live\|
How can I help you explore Laravel packages today?