Skip to content

[Bug]: .browserslistrc can not take effect #1004

@Timeless0911

Description

@Timeless0911

Details

Since Rslib have a configuration named syntax, when users specify syntax, it has a higher priority than .browserslistrc. And when users do not specify syntax, the default value will be esnext which will override the browsers list to last 1 versions of browsers.

See

const composeSyntaxConfig = (
target: RsbuildConfigOutputTarget,
syntax?: Syntax,
): EnvironmentConfig => {
// Defaults to ESNext, Rslib will assume all of the latest JavaScript and CSS features are supported.
if (syntax) {
return {
tools: {
rspack: (config) => {
config.target = transformSyntaxToRspackTarget(syntax);
},
},
output: {
overrideBrowserslist: transformSyntaxToBrowserslist(syntax, target),
},
};
}
return {
tools: {
rspack: (config) => {
config.target = ['es2022'];
return config;
},
},
output: {
// If `syntax` is not defined, Rslib will try to determine by the `target`, with the last version of the target.
overrideBrowserslist: ESX_TO_BROWSERSLIST.esnext(target),
},
};
};

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