{"id":20179,"library":"laravel-mix-polyfill","title":"laravel-mix-polyfill","description":"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.","status":"active","version":"3.0.1","language":"javascript","source_language":"en","source_url":"https://github.com/scottcharlesworth/laravel-mix-polyfill","tags":["javascript","laravel","laravel mix","mix","polyfill","babel","webpack"],"install":[{"cmd":"npm install laravel-mix-polyfill","lang":"bash","label":"npm"},{"cmd":"yarn add laravel-mix-polyfill","lang":"bash","label":"yarn"},{"cmd":"pnpm add laravel-mix-polyfill","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency required for Mix integration","package":"laravel-mix","optional":false}],"imports":[{"note":"This package does not export any named symbols; simply require it as a side-effect to register the .polyfill() method on Mix.","wrong":"import 'laravel-mix-polyfill';","symbol":"require('laravel-mix-polyfill')","correct":"require('laravel-mix-polyfill');"},{"note":"Call .polyfill() after setting up your mix rules, typically after .js() and .sass().","wrong":"mix.polyfill({ enabled: true }).js('src', 'dest');","symbol":"mix.polyfill()","correct":"mix.js('src', 'dest').polyfill({ enabled: true });"}],"quickstart":{"code":"// webpack.mix.js\nlet mix = require('laravel-mix');\nrequire('laravel-mix-polyfill');\n\nmix.js('resources/js/app.js', 'public/js')\n   .sass('resources/sass/app.scss', 'public/css')\n   .polyfill({\n      enabled: true,\n      useBuiltIns: 'usage',\n      targets: 'firefox 50, IE 11'\n   });","lang":"javascript","description":"Installs and configures laravel-mix-polyfill with usage-based polyfilling targeting Firefox 50 and IE 11."},"warnings":[{"fix":"Upgrade to Laravel Mix v6+ and Webpack v5.","message":"v3.0.0 drops support for Laravel Mix v5 and earlier; requires Laravel Mix v6+ and Webpack v5.","severity":"breaking","affected_versions":">=3.0.0"},{"fix":"Remove any manual @babel/polyfill imports; let the extension handle polyfill entries.","message":"v2.0.0 removes @babel/polyfill in favor of core-js and regenerator-runtime. If you imported core-js entries manually, they may conflict.","severity":"breaking","affected_versions":">=2.0.0"},{"fix":"Change useBuiltIns to 'usage' and let Babel inject only needed polyfills.","message":"Setting useBuiltIns: 'entry' is deprecated in core-js@3; consider using 'usage' for automatic per-file polyfilling.","severity":"deprecated","affected_versions":">=1.0.0"},{"fix":"Avoid configuring polyfills elsewhere in Babel config; rely solely on this extension.","message":"Mixing .polyfill() with other polyfill plugins (e.g., @babel/preset-env polyfill options) can cause duplicate or missing polyfills.","severity":"gotcha","affected_versions":"*"},{"fix":"Update to v3.0.1 or later.","message":"Setting debug: true with Laravel Mix v6.0.14+ and this extension v3.0.0 caused an error; fixed in v3.0.1.","severity":"gotcha","affected_versions":"3.0.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Add require('laravel-mix-polyfill') at the top of webpack.mix.js before using mix.polyfill().","cause":"The require('laravel-mix-polyfill') is missing or placed after calling mix.polyfill().","error":"TypeError: mix.polyfill is not a function"},{"fix":"Run npm install laravel-mix-polyfill --save-dev","cause":"Package not installed or not in node_modules.","error":"Error: Cannot find module 'laravel-mix-polyfill'"},{"fix":"Use a valid browserslist query like '> 0.25%, not dead' or ensure correct syntax.","cause":"Invalid or malformed browserslist string in the targets option.","error":"Error: Polyfill target 'firefox 50' is not a valid browserslist query"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}