Polyfill webpack
entry: ['core-js/fn/promise', './index.js']
, .
, polyfill ?
, polyfill Promise. polyfill , , . API, , Ponyfills.
Webpack ProvidePlugin
new webpack.ProvidePlugin({
Promise: 'es6-promise'
})
ProvidePlugin , , . A - , . .
, Promise, webpack :
var Promise = require('es6-promise');
, Promise - , -?
, ProvidePlugin webpack, , webpack.
ES5 es6?
, webpack, .
?
Promise , . es6-promise, , , Auto-polyfill.
Babel
{
"plugins": ["transform-runtime"]
}
babel-plugin-transform-runtime core-js , Promise. , , core-js Promise. , babel , , core-js/library, core-js README. :
const Promise = require('core-js/library/fn/promise');
core-js Promise Promise . . babel-plugin-transform-runtime - core-js aliasing. , webpack ProvidePlugin, , babel , .
es6- babel-runtime , ?
, . Babel JavaScript JavaScript, ES5. JavaScript, , ES5 .
require('babel-runtime/core-js/promise').default = require('es6-promise');
, es6-promise. , ES . Babel . . ES-.
?
, . , , , . , runel transform runtime , babel, webpack.
None.
polyfill . , , , , polyfill. , Promises , , , , . , , /. , Promise String.prototype.trimLeft.
. , - , (, webpack, eslint ..). , , , . , , , Node , , package.json engines.
- . , webpack , , jQuery -, (, , ). , , . , . , webpack Node verions >= 4.3.0, .