Skip to content

fix: add default value for browserslist config path#13159

Merged
JLHwung merged 1 commit intobabel:mainfrom
JLHwung:add-default-value-for-browserslist-config-path
Apr 15, 2021
Merged

fix: add default value for browserslist config path#13159
JLHwung merged 1 commit intobabel:mainfrom
JLHwung:add-default-value-for-browserslist-config-path

Conversation

@JLHwung
Copy link
Copy Markdown
Contributor

@JLHwung JLHwung commented Apr 15, 2021

Q                       A
Fixed Issues? Fixes recent CI vue e2e error (hopefully). Closes #13154
Patch: Bug Fix? Y
Major: Breaking Change?
Minor: New Feature?
Tests Added + Pass? Yes
Documentation PR Link
Any Dependency Changes?
License MIT

Thanks to investigations from @sodatea (#13154 (comment)), the vue-cli e2e error caught a regression introduced in #12189. When we switched from browserslist to browserslist.loadConfig, we should add default value for configPath like browserslist did here: https://github.com/browserslist/browserslist/blob/98d5352e06/index.js#L406-L408

I have added new tests on unspecified configPath.

Disclaimer: I didn't run vue-cli e2e tests, let's see if CI can be green.

@JLHwung JLHwung added PR: Bug Fix 🐛 A type of pull request used for our changelog categories i: regression labels Apr 15, 2021
options: GetTargetsOption = {},
): Targets {
let { browsers, esmodules } = inputTargets;
const { configPath = "." } = options;
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Unlike browserslist, we use "." instead of path.resolve(".") here to avoid import "path" so we don't have to add a packageJson.browsers field for this package.

browserslist will use path.resolve when it is running in a Node environment:

https://github.com/browserslist/browserslist/blob/209adf9e0051fa39a2b25354cffd493300f34b02/node.js#L302

@babel-bot
Copy link
Copy Markdown
Collaborator

Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/45227/

@codesandbox-ci
Copy link
Copy Markdown

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 2998625:

Sandbox Source
babel-repl-custom-plugin Configuration
babel-plugin-multi-config Configuration

Copy link
Copy Markdown
Member

@hzoo hzoo left a comment

Choose a reason for hiding this comment

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

thanks @sodatea and @JLHwung!

@JLHwung JLHwung merged commit 5d55055 into babel:main Apr 15, 2021
@JLHwung JLHwung deleted the add-default-value-for-browserslist-config-path branch April 15, 2021 21:05
@haoqunjiang
Copy link
Copy Markdown
Contributor

Thanks for the fix.
Do you have any planned release date that I can expect for this fix to be landed?
I'm not sure if I need to work around this issue in Vue CLI, too, if I'm gonna release a new version before the Babel patch.

@nicolo-ribaudo
Copy link
Copy Markdown
Member

There have been a few fixes on main, I can release now.

@haoqunjiang
Copy link
Copy Markdown
Contributor

Thank you so much!

@github-actions github-actions Bot added the outdated A closed issue/PR that is archived due to age. Recommended to make a new issue label Jul 21, 2021
@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Jul 21, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

i: regression outdated A closed issue/PR that is archived due to age. Recommended to make a new issue PR: Bug Fix 🐛 A type of pull request used for our changelog categories PR: Fixes failing main

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants