Skip to content
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
}]
]
}
}