Skip to content

optim: specify version in @babel/plugin-transform-runtime #80

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 18, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
const pkgJson = require('./package.json')

const runtimeVersion = pkgJson.dependencies['@babel/runtime']
// eslint-disable-next-line dot-notation -- this conflicts with tsc, possibly due to outdated ESLint
const NODE_ENV = process.env['NODE_ENV']

/** @type {import('@babel/core').ConfigFunction} */
module.exports = api => {
// eslint-disable-next-line dot-notation -- this conflicts with tsc, possibly due to outdated ESLint
api.cache.using(() => process.env['NODE_ENV']) // cache based on NODE_ENV
api.cache.using(() => NODE_ENV + '_' + runtimeVersion) // cache based on NODE_ENV and runtimeVersion

// normally use browserslistrc, but for Jest, use current version of Node
const isTest = api.env('test')
Expand All @@ -18,7 +23,10 @@ module.exports = api => {
],
plugins: [
// used with @rollup/plugin-babel
'@babel/plugin-transform-runtime'
['@babel/plugin-transform-runtime', {
regenerator: false, // not used, and would prefer babel-polyfills over this anyway
version: runtimeVersion // @babel/runtime's version
}]
]
}
}