Registry / devops / laravel-mix-polyfill

laravel-mix-polyfill

JSON →
library3.0.1jsnpmunverified

A Laravel Mix extension that integrates Babel, core-js, and regenerator-runtime to include polyfills in your Mix build. Version 3.0.1 is the latest stable release, compatible with Laravel Mix v6 and Webpack v5. It replaced the deprecated @babel/polyfill with core-js and regenerator-runtime in v2.0.0, and fixed a debug option error in v3.0.1. Compared to manual Babel configuration, this extension provides a simple Mix-friendly API for polyfill targeting via browserslist queries.

npm install laravel-mix-polyfill
INSTALL
IMPORT
SIG · LARAVEL-MIX-POLYFI
L
laravel-mix-polyfill
devopsjavascriptv3.0.1
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

require('laravel-mix-polyfill')
require('laravel-mix-polyfill');
import 'laravel-mix-polyfill';
This package does not export any named symbols; simply require it as a side-effect to register the .polyfill() method on Mix.
mix.polyfill()
mix.js('src', 'dest').polyfill({ enabled: true });
mix.polyfill({ enabled: true }).js('src', 'dest');
Call .polyfill() after setting up your mix rules, typically after .js() and .sass().

Installs and configures laravel-mix-polyfill with usage-based polyfilling targeting Firefox 50 and IE 11.

// webpack.mix.js let mix = require('laravel-mix'); require('laravel-mix-polyfill'); mix.js('resources/js/app.js', 'public/js') .sass('resources/sass/app.scss', 'public/css') .polyfill({ enabled: true, useBuiltIns: 'usage', targets: 'firefox 50, IE 11' });
Debug
Known issues
breakingv3.0.0 drops support for Laravel Mix v5 and earlier; requires Laravel Mix v6+ and Webpack v5.
fix
Upgrade to Laravel Mix v6+ and Webpack v5.
affects: >=3.0.0
breakingv2.0.0 removes @babel/polyfill in favor of core-js and regenerator-runtime. If you imported core-js entries manually, they may conflict.
fix
Remove any manual @babel/polyfill imports; let the extension handle polyfill entries.
affects: >=2.0.0
deprecatedSetting useBuiltIns: 'entry' is deprecated in core-js@3; consider using 'usage' for automatic per-file polyfilling.
fix
Change useBuiltIns to 'usage' and let Babel inject only needed polyfills.
affects: >=1.0.0
gotchaMixing .polyfill() with other polyfill plugins (e.g., @babel/preset-env polyfill options) can cause duplicate or missing polyfills.
fix
Avoid configuring polyfills elsewhere in Babel config; rely solely on this extension.
affects: *
gotchaSetting debug: true with Laravel Mix v6.0.14+ and this extension v3.0.0 caused an error; fixed in v3.0.1.
fix
Update to v3.0.1 or later.
affects: 3.0.0
Errors
Common errors & fixes
TypeError: mix.polyfill is not a function
The require('laravel-mix-polyfill') is missing or placed after calling mix.polyfill().
fix
Add require('laravel-mix-polyfill') at the top of webpack.mix.js before using mix.polyfill().
Error: Cannot find module 'laravel-mix-polyfill'
Package not installed or not in node_modules.
fix
Run npm install laravel-mix-polyfill --save-dev
Error: Polyfill target 'firefox 50' is not a valid browserslist query
Invalid or malformed browserslist string in the targets option.
fix
Use a valid browserslist query like '> 0.25%, not dead' or ensure correct syntax.
Upgrade
Version history
3.0.1latest on npm
Audit
Dependencies
laravel-mixrequiredPeer dependency required for Mix integration
Agent activity
4 hits · last 30 days
node
4
Resources
laravel-mix-polyfill — npm install laravel-mix-polyfill · libregistry