For AI agents: the complete documentation index is available at /llms.txt, the full documentation bundle is available at /llms-full.txt, and this page is available as Markdown at /configure/app/output/css-modules.md.

output.cssModules

  • Type:
type CssModules = {
  auto?:
    | boolean
    | RegExp
    | ((
        resourcePath: string,
        resourceQuery: string,
        resourceFragment: string,
      ) => boolean);
  exportLocalsConvention?:
    'asIs' | 'camelCase' | 'camelCaseOnly' | 'dashes' | 'dashesOnly';
  exportGlobals?: boolean;
  localIdentName?: string;
  mode?:
    | 'local'
    | 'global'
    | 'pure'
    | 'icss'
    | ((resourcePath: string) => 'local' | 'global' | 'pure' | 'icss');
  namedExport?: boolean;
};
  • Default:
const defaultCssModules = {
  auto: true,
  namedExport: false,
  exportGlobals: false,
  exportLocalsConvention: 'camelCase',
};

For custom CSS Modules configuration.

Info

The usage of this configuration item is exactly the same as that of Rsbuild. For detailed information, please refer to Rsbuild - output.cssModules.