tools.autoprefixer

  • Type: Object | Function
  • Default:
const defaultConfig = {
  flexbox: 'no-2009',
  // Depends on the browserslist config in the project
  // and the `output.overrideBrowserslist` (higher priority) config
  overrideBrowserslist: browserslist,
};

Use tools.autoprefixer to modify the configuration of the autoprefixer plugin that is built into Rsbuild.

TIP

If you have registered the autoprefixer plugin in the project yourself, tools.autoprefixer will not work.

Object Type

When tools.autoprefixer is configured as Object type, it is merged with the default config through Object.assign. For example:

export default {
  tools: {
    autoprefixer: {
      flexbox: 'no-2009',
    },
  },
};

Function Type

When tools.autoprefixer is a Function, the default config is passed as the first parameter and can be directly modified or returned as the final result. For example:

export default {
  tools: {
    autoprefixer(config) {
      // modify flexbox config
      config.flexbox = 'no-2009';
    },
  },
};