feat: default to core-js version 3 (#9987)

This commit is contained in:
Daniel Roe 2021-10-27 12:40:51 +01:00 committed by GitHub
parent eea6db1471
commit 293dc11ae6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 15 additions and 15 deletions

View File

@ -23,7 +23,7 @@
"@babel/preset-env": "^7.15.8", "@babel/preset-env": "^7.15.8",
"@babel/runtime": "^7.15.4", "@babel/runtime": "^7.15.4",
"@vue/babel-preset-jsx": "^1.2.4", "@vue/babel-preset-jsx": "^1.2.4",
"core-js": "^2.6.5", "core-js": "^3.19.0",
"core-js-compat": "^3.19.0", "core-js-compat": "^3.19.0",
"regenerator-runtime": "^0.13.9" "regenerator-runtime": "^0.13.9"
}, },

View File

@ -76,7 +76,7 @@ exports[`webpack nuxt webpack module.rules 1`] = `
\\"<nuxtDir>/packages/babel-preset-app/src/index.js\\", \\"<nuxtDir>/packages/babel-preset-app/src/index.js\\",
Object { Object {
\\"corejs\\": Object { \\"corejs\\": Object {
\\"version\\": 2, \\"version\\": 3,
}, },
}, },
], ],
@ -689,7 +689,7 @@ exports[`webpack nuxt webpack module.rules test=.jsx 1`] = `
\\"<nuxtDir>/packages/babel-preset-app/src/index.js\\", \\"<nuxtDir>/packages/babel-preset-app/src/index.js\\",
Object { Object {
\\"corejs\\": Object { \\"corejs\\": Object {
\\"version\\": 2, \\"version\\": 3,
}, },
}, },
], ],

View File

@ -125,7 +125,7 @@ export default class WebpackBaseConfig {
try { try {
corejsVersion = Number.parseInt(requireModule('core-js/package.json', rootDir).version.split('.')[0]) corejsVersion = Number.parseInt(requireModule('core-js/package.json', rootDir).version.split('.')[0])
} catch (_err) { } catch (_err) {
corejsVersion = 2 corejsVersion = 3
} }
} else { } else {
corejsVersion = Number.parseInt(corejsVersion) corejsVersion = Number.parseInt(corejsVersion)
@ -133,7 +133,7 @@ export default class WebpackBaseConfig {
if (![2, 3].includes(corejsVersion)) { if (![2, 3].includes(corejsVersion)) {
consola.warn(`Invalid corejs version ${corejsVersion}! Please set "build.corejs" to either "auto", 2 or 3.`) consola.warn(`Invalid corejs version ${corejsVersion}! Please set "build.corejs" to either "auto", 2 or 3.`)
corejsVersion = 2 corejsVersion = 3
} }
const defaultPreset = [this.resolveModule('@nuxt/babel-preset-app'), { const defaultPreset = [this.resolveModule('@nuxt/babel-preset-app'), {

View File

@ -20,26 +20,26 @@ describe('nuxt basic resources size limit', () => {
it('should stay within the size limit range in legacy mode', async () => { it('should stay within the size limit range in legacy mode', async () => {
const legacyResourcesSize = await getResourcesSize(distDir, 'client', { gzip: true, brotli: true }) const legacyResourcesSize = await getResourcesSize(distDir, 'client', { gzip: true, brotli: true })
const LEGACY_JS_RESOURCES_KB_SIZE = 217 const LEGACY_JS_RESOURCES_KB_SIZE = 240
expect(legacyResourcesSize.uncompressed).toBeWithinSize(LEGACY_JS_RESOURCES_KB_SIZE) expect(legacyResourcesSize.uncompressed).toBeWithinSize(LEGACY_JS_RESOURCES_KB_SIZE)
const LEGACY_JS_RESOURCES_GZIP_KB_SIZE = 75 const LEGACY_JS_RESOURCES_GZIP_KB_SIZE = 83
expect(legacyResourcesSize.gzip).toBeWithinSize(LEGACY_JS_RESOURCES_GZIP_KB_SIZE) expect(legacyResourcesSize.gzip).toBeWithinSize(LEGACY_JS_RESOURCES_GZIP_KB_SIZE)
const LEGACY_JS_RESOURCES_BROTLI_KB_SIZE = 64 const LEGACY_JS_RESOURCES_BROTLI_KB_SIZE = 72
expect(legacyResourcesSize.brotli).toBeWithinSize(LEGACY_JS_RESOURCES_BROTLI_KB_SIZE) expect(legacyResourcesSize.brotli).toBeWithinSize(LEGACY_JS_RESOURCES_BROTLI_KB_SIZE)
}) })
it('should stay within the size limit range in modern mode', async () => { it('should stay within the size limit range in modern mode', async () => {
const modernResourcesSize = await getResourcesSize(distDir, 'modern', { gzip: true, brotli: true }) const modernResourcesSize = await getResourcesSize(distDir, 'modern', { gzip: true, brotli: true })
const MODERN_JS_RESOURCES_KB_SIZE = 180 const MODERN_JS_RESOURCES_KB_SIZE = 210
expect(modernResourcesSize.uncompressed).toBeWithinSize(MODERN_JS_RESOURCES_KB_SIZE) expect(modernResourcesSize.uncompressed).toBeWithinSize(MODERN_JS_RESOURCES_KB_SIZE)
const MODERN_JS_RESOURCES_GZIP_KB_SIZE = 64 const MODERN_JS_RESOURCES_GZIP_KB_SIZE = 73
expect(modernResourcesSize.gzip).toBeWithinSize(MODERN_JS_RESOURCES_GZIP_KB_SIZE) expect(modernResourcesSize.gzip).toBeWithinSize(MODERN_JS_RESOURCES_GZIP_KB_SIZE)
const MODERN_JS_RESOURCES_BROTLI_KB_SIZE = 58 const MODERN_JS_RESOURCES_BROTLI_KB_SIZE = 64
expect(modernResourcesSize.brotli).toBeWithinSize(MODERN_JS_RESOURCES_BROTLI_KB_SIZE) expect(modernResourcesSize.brotli).toBeWithinSize(MODERN_JS_RESOURCES_BROTLI_KB_SIZE)
}) })
}) })

View File

@ -4618,10 +4618,10 @@ core-js-compat@^3.16.0, core-js-compat@^3.16.2, core-js-compat@^3.19.0:
browserslist "^4.17.5" browserslist "^4.17.5"
semver "7.0.0" semver "7.0.0"
core-js@^2.6.5: core-js@^3.19.0:
version "2.6.12" version "3.19.0"
resolved "https://registry.npmjs.org/core-js/-/core-js-2.6.12.tgz#d9333dfa7b065e347cc5682219d6f690859cc2ec" resolved "https://registry.npmjs.org/core-js/-/core-js-3.19.0.tgz#9e40098a9bc326c7e81b486abbd5e12b9d275176"
integrity sha512-Kb2wC0fvsWfQrgk8HU5lW6U/Lcs8+9aaYcy4ZFc6DDlo4nZ7n70dEgE5rtR0oG6ufKDUnrwfWL1mXR5ljDatrQ== integrity sha512-L1TpFRWXZ76vH1yLM+z6KssLZrP8Z6GxxW4auoCj+XiViOzNPJCAuTIkn03BGdFe6Z5clX5t64wRIRypsZQrUg==
core-util-is@1.0.2: core-util-is@1.0.2:
version "1.0.2" version "1.0.2"