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: browserslist config file support #9499

Closed
wants to merge 1 commit into from

Conversation

ms-fadaei
Copy link
Contributor

Add browserslist config file support

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

Resolves: #9337
After supporting modern browsers config in the Nuxt, there were two things that must be worked on it too:

  1. Retrieve targets browsers from browserslist config file (.browserlistrc): With this RP, now the Nuxt users can configure their target browsers from a separate file. (that is used by other packages like Autoprifixer, etc too)
  2. Target browsers detection on the server, which I reported in fix(babel-preset-app): respect explicit options.targets for modern preset #9337 and I think @clarkdo working on it currently

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.

@codecov-commenter
Copy link

codecov-commenter commented Jun 30, 2021

Codecov Report

Merging #9499 (3db2df9) into dev (eb6bd9f) will decrease coverage by 0.11%.
The diff coverage is 0.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##              dev    #9499      +/-   ##
==========================================
- Coverage   65.15%   65.04%   -0.12%     
==========================================
  Files          94       94              
  Lines        4107     4114       +7     
  Branches     1125     1127       +2     
==========================================
  Hits         2676     2676              
- Misses       1153     1158       +5     
- Partials      278      280       +2     
Flag Coverage Δ
unittests 65.04% <0.00%> (-0.12%) ⬇️

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 eb6bd9f...3db2df9. Read the comment docs.

Copy link
Member

@clarkdo clarkdo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. I think we can hold this pr for now until we support customized targets for SSR

@clarkdo
Copy link
Member

clarkdo commented Jun 30, 2021

Target browsers detection on the server, which I reported in fix(babel-preset-app): respect explicit options.targets for modern preset #9337 and I think @clarkdo working on it currently

Thanks for the reminder, I’ll find some time this week to look into it.

@pi0
Copy link
Member

pi0 commented Jun 30, 2021

Thanks for PR @ms-fadaei <3. I think for properly solving the issue mentioned in #9337 (comment), we should dynamically generate modernBrowsers based on specified server target. Relying on external config file like .browserlist is an anti-pattern in nuxt (since we lose a single source of trust) and also it needs more hassle to update the modern target. Pending for @clarkdo additions.

@pi0 pi0 added the pending label Jun 30, 2021
@ms-fadaei
Copy link
Contributor Author

ms-fadaei commented Jun 30, 2021

Thanks for your review @pi0. I will be happy to be part of fixing this issue based on the Nuxt principles, so please let me know what can I do for improving this?

@gkatsanos
Copy link

I run into this while looking at the documentation:

The default targets of @nuxt/babel-preset-app are ie: '9' in the client build, and node: 'current' in the server build.

Do I get this correctly that unless we use our own preset config, we're shipping IE9 compatible javascript?
So the browserslist config in package.json is ignored?

Any examples on changing this to target more modern browsers?

@danielroe
Copy link
Member

As Nuxt 2 is currently in maintenance-mode until June 30, 2024, we are not aiming to merge any more features and so, regretfully, I am closing this PR. My apologies that we weren't able to include it in v2.17 🙏

@danielroe danielroe closed this Jan 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants