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

fix(babel-preset-app): allow to specify corejs.version as string #8085

Merged
merged 1 commit into from
Sep 21, 2020
Merged

fix(babel-preset-app): allow to specify corejs.version as string #8085

merged 1 commit into from
Sep 21, 2020

Conversation

Yihao-G
Copy link

@Yihao-G Yihao-G commented Sep 16, 2020

Types of changes

  • Bug fix (a non-breaking change which fixes an issue)
  • New feature (a non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Description

According to the core-js documentation, it's recommended to specify used minor core-js version:

Warning! Recommended to specify used minor core-js version, like corejs: '3.6', instead of corejs: 3, since with corejs: 3 will not be injected modules which were added in minor core-js releases.

More examples in their documentation:

By default, @babel/preset-env with useBuiltIns: 'usage' option only polyfills stable features, but you can enable polyfilling of proposals by proposals option, as corejs: { version: '3.6', proposals: true }.

However, with the current implementation of babel-preset-app, only integers can be set as they are used as the key of coreJsMeta. This PR enables users to specify minor core-js versions by handling minor version string/number.

Checklist:

  • My change requires a change to the documentation.
  • I have updated the documentation accordingly. (PR: #)
  • I have added tests to cover my changes (if not applicable, please state why)

    babel-preset-app doesn't have any tests...

  • All new and existing tests are passing.

@codecov-commenter
Copy link

codecov-commenter commented Sep 16, 2020

Codecov Report

Merging #8085 into dev will decrease coverage by 0.07%.
The diff coverage is 0.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##              dev    #8085      +/-   ##
==========================================
- Coverage   68.98%   68.91%   -0.08%     
==========================================
  Files          91       91              
  Lines        3847     3851       +4     
  Branches     1047     1048       +1     
==========================================
  Hits         2654     2654              
- Misses        969      972       +3     
- Partials      224      225       +1     
Flag Coverage Δ
#unittests 68.91% <0.00%> (-0.08%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
packages/babel-preset-app/src/index.js 0.00% <0.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 064aac3...df5e3d9. Read the comment docs.

@Yihao-G Yihao-G changed the title feat(babel-preset-app): Allow to specify minor core-js version feat(babel-preset-app): allow to specify minor core-js version Sep 16, 2020
@Yihao-G Yihao-G marked this pull request as ready for review September 16, 2020 07:03
@pi0
Copy link
Member

pi0 commented Sep 16, 2020

Hi @Yihao-G Actually it is better to use build.corejs option to specify version and we do it by default. Still your PR seems a good fix 👍

@pi0 pi0 changed the title feat(babel-preset-app): allow to specify minor core-js version feat(babel-preset-app): allow to specify minor core-js version as string Sep 16, 2020
@pi0 pi0 changed the title feat(babel-preset-app): allow to specify minor core-js version as string fix(babel-preset-app): allow to specify minor core-js version as string Sep 16, 2020
@pi0 pi0 changed the title fix(babel-preset-app): allow to specify minor core-js version as string fix(babel-preset-app): allow to specify corejs.version as string Sep 16, 2020
@pi0 pi0 merged commit 4374e54 into nuxt:dev Sep 21, 2020
@pi0 pi0 mentioned this pull request Sep 21, 2020
@danielroe danielroe added the 2.x label Jan 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants