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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: rootMode: "upward" ignores local browserslist config #14873

Open
1 task
AprilArcus opened this issue Aug 24, 2022 · 4 comments
Open
1 task

[Bug]: rootMode: "upward" ignores local browserslist config #14873

AprilArcus opened this issue Aug 24, 2022 · 4 comments

Comments

@AprilArcus
Copy link

AprilArcus commented Aug 24, 2022

馃捇

  • Would you like to work on a fix?

How are you using Babel?

@babel/cli, babel-loader, babel-jest

Input code

See minimal repro at AprilArcus/rootmode-upward-with-browserslist-repro

Current and expected behavior

When invoking Babel with rootMode: "upward", local configs in .babelrc.js are respected, but the browserslist entry in package.json is not.

Expected behavior: browserslist should be read from the local package.json or .browserslistrc, and fall back to the root package.json or .browserslistrc if a local configuration is not found.

Environment

  System:
    OS: Linux 5.17 Debian GNU/Linux rodete 12 (rodete)
  Binaries:
    Node: 18.6.0 - /usr/bin/node
    npm: 8.15.1 - /usr/bin/npm
@babel-bot
Copy link
Collaborator

Hey @AprilArcus! We really appreciate you taking the time to report an issue. The collaborators on this project attempt to help as many people as possible, but we're a limited number of volunteers, so it's possible this won't be addressed swiftly.

If you need any help, or just have general Babel or JavaScript questions, we have a vibrant Slack community that typically always has someone willing to help. You can sign-up here for an invite.

@nicolo-ribaudo
Copy link
Member

For reference: .browserslistrc is supposed to be file-relative and not root/project-relative: babel/rfcs#2 (comment)

@AprilArcus
Copy link
Author

AprilArcus commented Aug 24, 2022

I don't think I understand the comment you linked. It seems to me that a monorepo with multiple NPM workspaces in myRepo/apps/* should be able to target each app to a different set of supported browsers, and have that config live in a single location that can be read by e.g. both Webpack and Babel.

It would also be desirable for any workspaces destined to be published to NPM as packages to have an es5 or es2017 baseline target, configured separately from a bundled app that would target evergreen browsers.

@nicolo-ribaudo
Copy link
Member

nicolo-ribaudo commented Aug 24, 2022

Yes, I agree with your expected behavior 馃憤 That was a comment from the browserslist author saying that different folders should be able to target different configs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants