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

feat: default to core-js version 3 #9987

Merged
merged 4 commits into from Oct 27, 2021
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/babel-preset-app/package.json
Expand Up @@ -23,7 +23,7 @@
"@babel/preset-env": "^7.15.8",
"@babel/runtime": "^7.15.4",
"@vue/babel-preset-jsx": "^1.2.4",
"core-js": "^2.6.5",
"core-js": "^3.19.0",
"core-js-compat": "^3.19.0",
"regenerator-runtime": "^0.13.9"
},
Expand Down
4 changes: 2 additions & 2 deletions packages/webpack/src/config/base.js
Expand Up @@ -125,15 +125,15 @@ export default class WebpackBaseConfig {
try {
corejsVersion = Number.parseInt(requireModule('core-js/package.json', rootDir).version.split('.')[0])
} catch (_err) {
corejsVersion = 2
corejsVersion = 3
}
} else {
corejsVersion = Number.parseInt(corejsVersion)
}

if (![2, 3].includes(corejsVersion)) {
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'), {
Expand Down
12 changes: 6 additions & 6 deletions test/dev/async-config.size-limit.test.js
Expand Up @@ -20,26 +20,26 @@ describe('nuxt basic resources size limit', () => {
it('should stay within the size limit range in legacy mode', async () => {
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)

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)

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)
})

it('should stay within the size limit range in modern mode', async () => {
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)

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)

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)
})
})
8 changes: 4 additions & 4 deletions yarn.lock
Expand Up @@ -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"
semver "7.0.0"

core-js@^2.6.5:
version "2.6.12"
resolved "https://registry.npmjs.org/core-js/-/core-js-2.6.12.tgz#d9333dfa7b065e347cc5682219d6f690859cc2ec"
integrity sha512-Kb2wC0fvsWfQrgk8HU5lW6U/Lcs8+9aaYcy4ZFc6DDlo4nZ7n70dEgE5rtR0oG6ufKDUnrwfWL1mXR5ljDatrQ==
core-js@^3.19.0:
version "3.19.0"
resolved "https://registry.npmjs.org/core-js/-/core-js-3.19.0.tgz#9e40098a9bc326c7e81b486abbd5e12b9d275176"
integrity sha512-L1TpFRWXZ76vH1yLM+z6KssLZrP8Z6GxxW4auoCj+XiViOzNPJCAuTIkn03BGdFe6Z5clX5t64wRIRypsZQrUg==

core-util-is@1.0.2:
version "1.0.2"
Expand Down