A Laravel Mix extension for Babel Polyfill.
First, install the extension.
npm install laravel-mix-polyfill --save-dev
or
yarn add laravel-mix-polyfill --dev
Then, require it within your webpack.mix.js
file:
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}
});
Name | Type | Default | Description |
---|---|---|---|
enabled | boolean |
true |
Should polyfill be used. |
useBuiltIns | string |
"usage" |
See here and here for detailed description. |
targets | string , object , boolean |
"defaults" |
Allows a target (browser) environment to be specified. This can either be: • a browserslist-compatible query ( "> 0.25%, not dead" ), • an object of minimum environment versions to support ( {"chrome": "58", "ie": "11"} ),• or false to transform all ECMAScript 2015+ code by default. • Setting to false will also allow use of browserslist config sources (like .browserslistrc). See here and here for more information. You can test string values on browserl.ist. |
corejs | number |
2 |
The version of core-js to be used. |
debug | boolean |
false |
Outputs the targets/plugins used to the console. |