ui5-shim-babel-polyfill
Custom UI5 project shim extension for babel polyfill dependencies.
As of Babel 7.4.0, @babel/polyfill has been deprecated in favor of directly including core-js/stable (to polyfill ECMAScript features) and regenerator-runtime/runtime (needed to use transpiled generator functions).
Using this project shim both dependencies can be easily consumed in your ui5 application.
This is especially useful when using ui5-task-babel or ui5-middleware-babel.
Prerequisites
Make sure your project is using the latest UI5 Tooling.
Getting started
Install
Custom project shim
Add the custom project shim and its peer dependencies as dependencies
to your project.
With yarn
:
yarn add ui5-shim-babel-polyfill core-js-bundle regenerator-runtime
Or npm
:
npm i ui5-shim-babel-polyfill core-js-bundle regenerator-runtime
Additionally the custom project shim its peer dependencies need to be manually defined in ui5.dependencies
in your project's package.json
:
{
"ui5": {
"dependencies": [
"ui5-shim-babel-polyfill",
"core-js-bundle",
"regenerator-runtime"
]
}
}
Usage
Register core-js/stable and regenerator-runtime/runtime as resources your projects manifest.json
.
This will ensure both dependencies will be included once in your app and all required polyfills will be available for your transpiled code.
{
"sap.ui5": {
"resources": {
"js": [
{
"uri": "/resources/core-js-bundle/minified.js"
},
{
"uri": "/resources/regenerator-runtime/runtime.js"
}
]
}
}
}