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): respect explicit options.targets for modern preset #9337

Merged
merged 1 commit into from May 30, 2021

Conversation

clarkdo
Copy link
Member

@clarkdo clarkdo commented May 26, 2021

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)

Fix #9315

We used to limit targets of modern preset can only be {esModules: true} for not breaking matching between browsers which support <script type="module"> and corresponding modern syntax, but it makes sense that let users specify a more modern targets manually if they know exactly what is the target browsers.

@pi0 Do you think we need to add a cli info message here about overrding default modern preset targets may break browsers which support <script type="module"> but not implement more modern ecma syntax yet ?

Description

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)
  • All new and existing tests are passing.

@clarkdo clarkdo requested review from pi0 and danielroe May 26, 2021 19:30
@codecov-commenter
Copy link

Codecov Report

Merging #9337 (06a07c5) into dev (b116d0d) will increase coverage by 0.03%.
The diff coverage is 0.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##              dev    #9337      +/-   ##
==========================================
+ Coverage   65.11%   65.14%   +0.03%     
==========================================
  Files          94       94              
  Lines        4108     4106       -2     
  Branches     1125     1124       -1     
==========================================
  Hits         2675     2675              
+ Misses       1154     1153       -1     
+ Partials      279      278       -1     
Flag Coverage Δ
unittests 65.14% <0.00%> (+0.03%) ⬆️

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 b116d0d...06a07c5. Read the comment docs.

@pi0
Copy link
Member

pi0 commented May 26, 2021

Having a way to modernize more than esmodule baseline is a nice idea.

Do you think we need to add a cli info message here about overrding default modern preset targets may break browsers which support <script type="module"> but not implement more modern ecma syntax yet ?

We can mention this possibility in documentation and add notes about browser compatibility. But generally i think it is not a bad choice for targeting real modern browsers.

@clarkdo clarkdo merged commit b9bfb9d into dev May 30, 2021
@clarkdo clarkdo deleted the fix/modern-targets branch May 30, 2021 17:13
@ms-fadaei
Copy link
Contributor

@pi0

I have a question based on this PR.

With this fix, we just configure the babel. but what about modern mode with server detection? The source code here shows the browsers that can be used in modern mode (on server detection). but when we change the target in babel, the server serves the wrong file, and everything broke! Am I wrong?

@pi0
Copy link
Member

pi0 commented Jun 17, 2021

You are correct @ms-fadaei. In fact, we should also make server detection configurable otherwise ESM...modern browsers will be broken. /cc @clarkdo

@clarkdo
Copy link
Member Author

clarkdo commented Jun 17, 2021

Good catch, I’ll look into this and try to make a pr

@pi0 pi0 mentioned this pull request Aug 11, 2021
@danielroe danielroe added the 2.x label Jan 18, 2023
@danielroe danielroe mentioned this pull request Jan 19, 2023
@danielroe danielroe mentioned this pull request Feb 1, 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.

Some corejs modules are imported regardless of target browsers
5 participants