Home > @lynx-js/rspeedy > CssLoader > modules

CssLoader.modules property

The cssLoader.modules option enables/disables the CSS Modules specification and setup basic behavior.

Signature:

modules?: boolean | CssLoaderModules | undefined;

Example 1

Using false value to increase performance because we avoid parsing CSS Modules features, it will be useful for developers who use vanilla css or use other technologies.

import { defineConfig } from '@lynx-js/rspeedy'

export default defineConfig({
  tools: {
    cssLoader: {
      modules: false,
    },
  },
})

Example 2

Using () => true value to enable CSS Modules for all files.

import { defineConfig } from '@lynx-js/rspeedy'

export default defineConfig({
  tools: {
    cssLoader: {
      modules: () => true,
    },
  },
})

Example 3

Using object value to enable CSS Modules based-on CssLoaderModules.auto option and setup more configurations about CSS Modules.

import { defineConfig } from '@lynx-js/rspeedy'

export default defineConfig({
  tools: {
    cssLoader: {
      modules: {
        namedExport: true,
      },
    },
  },
})
Except as otherwise noted, this work is licensed under a Creative Commons Attribution 4.0 International License, and code samples are licensed under the Apache License 2.0.