v4.1.11 - Bug fixes & files inclusion
v4.1.11
Bug Fixes
Fixed conflict with lodash and other libraries using _ global
The minified JavaScript output was previously not wrapped in an IIFE (Immediately Invoked Function Expression), causing internal variables to leak into the global scope. The minifier assigned the name _ to an internal function, which overwrote
window._ when lodash was present in the consuming application.
The Vite build configuration now outputs the JavaScript in IIFE format, ensuring all internal variables remain scoped within a closure and don't pollute the global namespace.
Improvements
Included documentation in Composer distribution
README.md is now included when installing via Composer. This helps developers and AI coding assistants (Claude, Copilot, Cursor, etc.) access documentation directly from vendor/scify/laravel-cookie-guard/ without needing to visit GitHub.
CLAUDE.md continues to be included, providing detailed codebase context for AI-assisted development.
Solves #57
Added JavaScript build output tests
New automated tests verify the compiled JavaScript:
- Wrapped in IIFE to prevent global scope pollution
- No global _ function that could conflict with lodash
- Public API (window.toggleCookieBanner) correctly exposed
- Strict mode enabled
Run with npm test.