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

[Bug]: Can't extend browserslist config #2443

Closed
CPatchane opened this issue May 26, 2024 · 9 comments
Closed

[Bug]: Can't extend browserslist config #2443

CPatchane opened this issue May 26, 2024 · 9 comments
Assignees
Labels
🐞 bug Something isn't working 🎯 upstream

Comments

@CPatchane
Copy link

CPatchane commented May 26, 2024

Version

System:
    OS: macOS 13.5.1
    CPU: (10) arm64 Apple M1 Pro
    Memory: 66.70 MB / 16.00 GB
    Shell: 3.6.1 - /opt/homebrew/bin/fish
  Browsers:
    Brave Browser: 120.1.61.116
    Chrome Canary: 127.0.6503.0
    Safari: 16.6
  npmPackages:
    @rsbuild/core: ^0.6.15 => 0.6.15
    @rsbuild/plugin-react: ^0.6.15 => 0.6.15

Details

Hi here 👋

I want to report that when using rsbuild (see the repo with a fresh create-rsbuild project), we can't extends a browserslist config from the npm package through the package.json (same thing if I do through a .browserslistrc file):

"browserslist": [
  "extends @getaround-eu/browserslist-config"
]
error   Failed to build.
error   Cannot find module '@getaround-eu/browserslist-config'
    at Function.webpackEmptyContext [as resolve] (/Users/me/Dev/projects/rsbuild-browserslist/node_modules/.pnpm/@[email protected]_@[email protected]/node_modules/@rsbuild/shared/compiled/browserslist/index.js:1913:10)
    at Object.loadQueries (/Users/me/Dev/projects/rsbuild-browserslist/node_modules/.pnpm/@[email protected]_@[email protected]/node_modules/@rsbuild/shared/compiled/browserslist/index.js:1424:51)
    at Function.select (/Users/me/Dev/projects/rsbuild-browserslist/node_modules/.pnpm/@[email protected]_@[email protected]/node_modules/@rsbuild/shared/compiled/browserslist/index.js:1159:26)
    at /Users/me/Dev/projects/rsbuild-browserslist/node_modules/.pnpm/@[email protected]_@[email protected]/node_modules/@rsbuild/shared/compiled/browserslist/index.js:353:29
    at Array.reduce (<anonymous>)
    at resolve (/Users/me/Dev/projects/rsbuild-browserslist/node_modules/.pnpm/@[email protected]_@[email protected]/node_modules/@rsbuild/shared/compiled/browserslist/index.js:343:34)
    at browserslist (/Users/me/Dev/projects/rsbuild-browserslist/node_modules/.pnpm/@[email protected]_@[email protected]/node_modules/@rsbuild/shared/compiled/browserslist/index.js:445:21)
    at browserslistToESVersion (/Users/me/Dev/projects/rsbuild-browserslist/node_modules/.pnpm/@[email protected]_@[email protected]/node_modules/@rsbuild/shared/dist/getBrowserslist.js:92:59)
    at handler (/Users/me/Dev/projects/rsbuild-browserslist/node_modules/.pnpm/@[email protected]/node_modules/@rsbuild/core/dist/plugins/target.js:41:69)
    at async Object.call (/Users/me/Dev/projects/rsbuild-browserslist/node_modules/.pnpm/@[email protected]/node_modules/@rsbuild/core/dist/initHooks.js:45:22)
 ELIFECYCLE  Command failed with exit code 1.

Note: When I passe that config directory through the output.overrideBrowserslist property in the rsbuild.config.ts config file, it works correctly.

Reproduce link

https://github.com/CPatchane/rsbuild-browserslist-issue

Reproduce Steps

Just run pnpm dev or pnpm build

@CPatchane CPatchane added the 🐞 bug Something isn't working label May 26, 2024
@CPatchane CPatchane changed the title [Bug]: Can't extends browserslist config [Bug]: Can't extend browserslist config May 26, 2024
@chenjiahan chenjiahan self-assigned this May 27, 2024
@chenjiahan
Copy link
Member

SWC uses browserslist-rs and its unreleased version supports the extends syntax:

browserslist/browserslist-rs@04fcad2

So we need to wait for browserslist-rs and SWC to release a new version, it will take some time.

@CPatchane
Copy link
Author

SWC uses browserslist-rs and its unreleased version supports the extends syntax:
browserslist/browserslist-rs@04fcad2
So we need to wait for browserslist-rs and SWC to release a new version, it will take some time.

Oh thanks a lot for your quick actions and response, until then I guess passing through the output.overrideBrowserslist is a good workaround 👍

@CPatchane
Copy link
Author

So we need to wait for browserslist-rs and SWC to release a new version, it will take some time.

@chenjiahan They just released the v0.16.0 version that support that feature :)
https://github.com/browserslist/browserslist-rs/releases/tag/v0.16.0

@chenjiahan
Copy link
Member

Nice 👍 The next step is to make SWC bump the dependency version, can you create an issue in the SWC repo?

@CPatchane
Copy link
Author

Actually, it's already there swc-project/swc#9023

@chenjiahan
Copy link
Member

There is some discussion about switching from browserslist-rs to oxc-browserslist, which may take some time to resolve.

@CPatchane
Copy link
Author

Yeah I saw that too, would that switch be good for you? I can't see if that would fix our issue here or not.

@chenjiahan
Copy link
Member

Bumping browserslist-rs will fix our issue, I'm not sure if switching will solve it.

@CPatchane
Copy link
Author

They chose to upgrade browserslist-rc, so we should be good :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐞 bug Something isn't working 🎯 upstream
Projects
None yet
Development

No branches or pull requests

2 participants