babel-runtime
's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.Name | Version | Size | License | Type | Vulnerabilities |
---|---|---|---|---|---|
core-js | 2.6.12 | 548.99 kB | MIT | prod | 2 |
regenerator-runtime | 0.11.1 | 7.64 kB | MIT | prod |
babel-runtime
is a tool that helps to ensure the code written with newer language syntax can be executed in older environments, addressing runtime problems. This npm package works in conjunction with Babel, a JavaScript compiler, and provides a sandboxed environment for your code. It was designed to solve the problem of polluting the global scope when using Babel for transformations. The package includes built-ins and other features that aren't included in the main Babel packages and prevents the same helper code from appearing in multiple places in your output code.
To use babel-runtime
, you'll first have to install it via npm, in your project directory using the command:
npm install --save babel-runtime
And install the Babel plugin with the command:
npm install --save-dev @babel/plugin-transform-runtime
After installation, you can enable this in your Babel configurations. In your .babelrc
file, add "@babel/plugin-transform-runtime"
to your plugins. For example:
{
"plugins": [
"@babel/plugin-transform-runtime"
]
}
Now, you can run your project normally. All your code will automatically refer to babel-runtime
whenever Babel would generally use its helpers.
The babel-runtime
docs can be found within the Babel documentation on its official GitHub page. You can view all related information, including installation guides, usage examples, and the API reference on the Babel GitHub page under the babel-runtime
directory here: Babel Runtime Docs.