Skip to content

[Bug]: Loading browserslist configuration from env variable fails even though it was successful #11527

@Themezv

Description

@Themezv

System Info

doesn't matter

Details

  1. browserslist-rs supports environment variables: The underlying browserslist-rs library correctly reads and processes environment variables like BROWSERSLIST.
  2. The condition in next code snippet truthy and error throwed
    `
    let browsers = binding_default().loadBrowserslist(inlineQuery, context);

if (!browsers || !inlineQuery && !hasBrowserslistConfig(context)) throw Error(No browserslist config found to handle the 'browserslist' target.
hasBrowserslistConfig falsy because using browserslist-load-config which doesn't check env variable

Reproduce link

https://github.com/Themezv/rspack-browserslist-env-bug

Reproduce Steps

  1. install dependencies (npm install)
  2. run build (npm run build)
  3. observe resolved browsers and error

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions