try to add

"plugins": ["@babel/plugin-transform-runtime"]

in .babelrc

Answer from lovelyPrackets on Stack Overflow
🌐
Babel
babeljs.io › @babel/plugin-transform-runtime
@babel/plugin-transform-runtime · Babel
A plugin that enables the re-use of Babel's injected helper code to save on codesize. Install it as development dependency. ... The transformation plugin is typically used only in development, but the runtime itself will be depended on by your deployed code.
🌐
npm
npmjs.com › package › @babel › plugin-transform-runtime
@babel/plugin-transform-runtime - npm
June 17, 2026 - Externalise references to helpers and builtins, automatically polyfilling your code without polluting globals. Latest version: 7.29.0, last published: 20 days ago. Start using @babel/plugin-transform-runtime in your project by running `npm i ...
      » npm install @babel/plugin-transform-runtime
    
Published   Jan 31, 2026
Version   7.29.0
🌐
GitHub
github.com › babel › babel › tree › master › packages › babel-plugin-transform-runtime
babel/packages/babel-plugin-transform-runtime at master · babel/babel
🐠 Babel is a compiler for writing next generation JavaScript. - babel/packages/babel-plugin-transform-runtime at master · babel/babel
Author   babel
🌐
GitHub
github.com › babel › babel › issues › 16149
[Documentation-Bug]: Can @babel/plugin-transform-runtime be used together with useBuiltIns ? · Issue #16149 · babel/babel
December 4, 2023 - Should I use useBuiltIns: 'usage' and corejs option on @babel/preset-env together with @babel/transform-runtime with core-js option set to false? The answer is NO... But I have use "plugins": [["@babel/plugin-transform-runtime", {}]] together with "useBuiltIns": "usage" all the time and I did not experience any problem while with a smaller bundled file size.
Author   babel
🌐
GitHub
github.com › babel › website › blob › main › docs › plugin-transform-runtime.md
website/docs/plugin-transform-runtime.md at main · babel/website
Toggles whether or not inlined Babel helpers (classCallCheck, extends, etc.) are replaced with calls to @babel/runtime (or equivalent package). For more information, see Helper aliasing. ... The helpers option will be removed in Babel 8, as this plugin will only be used to inject helpers (including regeneratorRuntime, which will be handled as any other Babel helper). ... This option controls which package of helpers @babel/plugin-transform-runtime will use when injecting imports.
Author   babel
Top answer
1 of 1
3

By default, @babel/plugin-transform-runtime is only allowed to output references to @babel/runtime that work on ^7.0.0 because it does not know what version you'd otherwise want to use, and doing anything else would cause lots of issues for users. This means that what you want to do is safe. The downside of this is that, if we add new helpers moving forward, your code would not be able to take advantage of the @babel/runtime version of them (because you might still be using a @babel/runtime version that doesn't have them.

Users can specify the version in the arguments for the transform, if you want to specifically make use of helpers that may have been added to Babel since 7.0.0, e.g.

{
  "plugins": [
    ["@babel/plugin-transform-runtime", { version: "^7.2.0" }],
  ]
}

would then require you to have "@babel/runtime": "^7.2.0" in your package.json.

For instance, since support for the newer decorators proposal didn't land until Babel 7.1.5, if you use transform-runtime and non-legacy decorators, the decorators helper will still be inserted into every file where you use decorators, instead of importing it from @babel/runtime. To get the shared helper, you need to specify version: "^7.1.5" in your options for transform-runtime.

Can I (as a library author) specify @babel/runtime dependency as ^7.0.0, whilst having the latest @babel/plugin-transform-runtime?

Yes, this is safe.

I'm guessing this should no longer be the case with the current stable version?

Correct, that issue was because people failed to take the beta versioning into account.

🌐
GitHub
github.com › babel › babel › issues › 13157
Default in Babel 8 to use @babel/plugin-transform-runtime · Issue #13157 · babel/babel
April 15, 2021 - Feature Request Is your feature request related to a problem? We all want our bundles to be as small as possible. Using @babel/plugin-transform-runtime definitely does this. Describe the solution you'd like It would be nice if @babel/plu...
Author   babel
🌐
Babel
babeljs.io › @babel/runtime
@babel/runtime · Babel
With @babel/plugin-transform-runtime, it would replace the reference to the function to the @babel/runtime version.
Find elsewhere
🌐
Snyk
snyk.io › advisor › @babel/plugin-transform-runtime › @babel/plugin-transform-runtime code examples
@babel/plugin-transform-runtime Code Examples | Snyk
September 14, 2022 - } ] ] const plugins = [ require('@babel/plugin-syntax-dynamic-import'), [ require('@babel/plugin-proposal-object-rest-spread'), { useBuiltIns: true } ], // Polyfills the runtime needed for async/await, generators, and friends // https://babeljs.io/docs/en/babel-plugin-transform-runtime [ require('@babel/plugin-transform-runtime').default, { corejs: false, helpers: false, regenerator: true, // https://babeljs.io/docs/en/babel-plugin-transform-runtime#useesmodules // We should turn this on once the lowest version of Node LTS // supports ES Modules. useESModules: false, // Undocumented option tha
🌐
Thoughtspile
thoughtspile.github.io › 2021 › 10 › 06 › babel-runtime-version
Is your babel's transform-runtime getting lazy? You better check.
October 6, 2021 - For some reason, transform-runtime assumes you have @babel/runtime version 7.0.0, and if a helper was not in runtime@7.0.0, it won't bother importing it. Babel is at 7.15.x now, and a lot has changed. Anyways, if you pass the real runtime version you installed: exports = { "plugins": [ ["@babel/plugin-transform-runtime", { // this is the magic line "version": "7.15.0" }] ] }
🌐
webpack
webpack.js.org › loaders › babel-loader
babel-loader | webpack
rules: [ // the 'transform-runtime' plugin tells Babel to // require the runtime instead of inlining it.
🌐
GitHub
github.com › babel › babel › issues › 12445
Cannot find module '@babel/plugin-transform-runtime' · Issue #12445 · babel/babel
December 4, 2020 - The application should compile and run in docker like it did before having to add the transform runtime and @babel/runtime · Babel Configuration (babel.config.js, .babelrc, package.json#babel, cli command, .eslintrc) ... { "presets": [ [ "@babel/preset-env", { "useBuiltIns": "entry", "corejs": 3, "targets": "> 0.25%, not dead" } ], "@babel/preset-typescript", "@babel/preset-react" ], "plugins": [ "@babel/plugin-transform-runtime", "@babel/plugin-proposal-class-properties", "@babel/plugin-proposal-async-generator-functions", "@babel/plugin-proposal-object-rest-spread", "@babel/plugin-proposal-
Author   babel
🌐
GitHub
github.com › babel › babel › issues › 11885
[@babel/plugin-transform-runtime] Option absoluteRuntime not working as expected · Issue #11885 · babel/babel
July 28, 2020 - var _interopRequireDefault = require("<ABSOLUTE_PATH>/@babel/runtime-corejs3/helpers/interopRequireDefault"); var _map = _interopRequireDefault(require("<ABSOLUTE_PATH>/@babel/runtime-corejs3/core-js-stable/instance/map")); // ... Babel Configuration (babel.config.js, .babelrc, package.json#babel, cli command, .eslintrc) ... { "presets": ["@babel/preset-env"], "plugins": [["@babel/plugin-transform-runtime", { "helpers": true, "absoluteRuntime": true, "corejs": 3 }]] }
Author   babel
🌐
GitHub
github.com › babel › babel › issues › 8815
ReferenceError: Unknown plugin "@babel/transform-runtime" specified · Issue #8815 · babel/babel
October 5, 2018 - "dependencies": { "@babel/polyfill": "^7.0.0", "@babel/runtime": "^7.1.2", "axios": "^0.18.0", "babel-plugin-transform-runtime": "^6.23.0", "body-parser": "^1.18.3", "cors": "^2.8.4", "electron-log": "^2.2.16", "electron-squirrel-startup": "^1.0.0", "electron-store": "^2.0.0", "electron-updater": "^3.0.3", "express": "^4.16.3", "fluent-ffmpeg": "^2.1.2", "request": "^2.87.0", "video.js": "^7.0.5", "vue-i18n": "^7.3.3", "vue-video-player": "^5.0.2", "ytdl-core": "^0.20.4" }, "devDependencies": { "babel-eslint": "^8.2.1", "devtron": "1.4.0", "electron": "^2.0.8", "electron-builder": "^20.22.0",
Author   babel
🌐
npm
npmjs.com › package › babel-plugin-transform-runtime
babel-plugin-transform-runtime - npm
Babel uses very small helpers for common functions such as _extend. By default this will be added to every file that requires it. This duplication is sometimes unnecessary, especially when your application is spread out over multiple files. This is where the transform-runtime plugin comes in: all of the helpers will reference the module babel-runtime to avoid duplication across your compiled output.
      » npm install babel-plugin-transform-runtime
    
Published   Feb 13, 2017
Version   6.23.0
🌐
Babel
babeljs.io › docs › v7-migration
Upgrade to Babel 7 · Babel
@babel/runtime now only contains the helpers, and if you need core-js you can use @babel/runtime-corejs2 and the option provided in the transform. For both you still need the @babel/plugin-transform-runtime
🌐
GitHub
github.com › babel › babel › issues › 11539
@babel/plugin-transform-runtime bring unnecessary polyfill with corejs configuration. · Issue #11539 · babel/babel
May 9, 2020 - // source new Promise(() => null); // .browserslistrc Chrome >= 78 // .babelrc { "presets": [ [ "@babel/preset-env", { "spec": false, "loose": false, "useBuiltIns": "usage", "corejs": 3, "modules": "commonjs" } ] ], "plugins": [ [ "@babel/plugin-transform-runtime", { "corejs": 3, "helpers": true, "regenerator": true, "useESModules": false } ] ] } // output "use strict"; var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault"); var _promise = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/promise")); new _promise.default(function () { return null; });
Author   babel
🌐
GitHub
github.com › babel › babel › issues › 9841
Babel 7 uses babel-plugin-transform-runtime instead of @babel/plugin-transform-runtime · Issue #9841 · babel/babel
April 9, 2019 - module.exports = { presets: [ '@babel/preset-env' ], plugins: [ '@babel/plugin-transform-runtime' ] };
Author   babel