mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-11 08:33:53 +00:00
fix(babel-preset-app): allow to specify corejs.version
as string (#8085)
This commit is contained in:
parent
761d2abb7f
commit
4374e541ee
@ -15,8 +15,16 @@ const coreJsMeta = {
|
||||
}
|
||||
}
|
||||
|
||||
function getMajorVersion (version) {
|
||||
if (typeof version === 'number') {
|
||||
return Math.floor(version)
|
||||
} else {
|
||||
return Number(version.split('.')[0])
|
||||
}
|
||||
}
|
||||
|
||||
function getDefaultPolyfills (corejs) {
|
||||
const { prefixes: { es6, es7 } } = coreJsMeta[corejs.version]
|
||||
const { prefixes: { es6, es7 } } = coreJsMeta[getMajorVersion(corejs.version)]
|
||||
return [
|
||||
// Promise polyfill alone doesn't work in IE,
|
||||
// Needs this as well. see: #1642
|
||||
@ -33,7 +41,7 @@ function getDefaultPolyfills (corejs) {
|
||||
|
||||
function getPolyfills (targets, includes, { ignoreBrowserslistConfig, configPath, corejs }) {
|
||||
const { default: getTargets, isRequired } = require('@babel/helper-compilation-targets')
|
||||
const builtInsList = require(coreJsMeta[corejs.version].builtIns)
|
||||
const builtInsList = require(coreJsMeta[getMajorVersion(corejs.version)].builtIns)
|
||||
const builtInTargets = getTargets(targets, {
|
||||
ignoreBrowserslistConfig,
|
||||
configPath
|
||||
|
Loading…
Reference in New Issue
Block a user