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: add default value for browserslist config path #13159

Merged

Conversation

JLHwung
Copy link
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
@@ -179,6 +179,7 @@ export default function getTargets(
options: GetTargetsOption = {},
): Targets {
let { browsers, esmodules } = inputTargets;
const { configPath = "." } = options;
Copy link
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
Collaborator

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

@codesandbox-ci
Copy link

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
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
@sodatea
Copy link
Contributor

sodatea commented Apr 20, 2021

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
Member

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

@sodatea
Copy link
Contributor

sodatea commented Apr 20, 2021

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.

None yet

5 participants