For AI agents: the complete documentation index is available at /next/llms.txt, the full documentation bundle is available at /next/llms-full.txt, and this page is available as Markdown at /next/api/packages/rspeedy/interfaces/Tools.md.
Lynx
  • English
  • Interface: Tools

    The Tools options changes the behavior of various building tools.

    Properties

    bundlerChain?

    optional bundlerChain?: ToolsBundlerChainConfig

    The Tools.bundlerChain changes the options of Rspack using rspack-chain.

    Default Value

    undefined

    Example

    import { defineConfig } from '@lynx-js/rspeedy'
    
    export default defineConfig({
      tools: {
        bundlerChain(chain) {
          chain.resolve.fullySpecified(true)
        },
      },
    })

    See rspack-chain for details.


    cssExtract?

    optional cssExtract?: CssExtract

    The CssExtract controls the options of CssExtractRspackPlugin

    Default Value

    undefined

    cssLoader?

    optional cssLoader?: CssLoader

    The CssLoader controls the options of css-loader.

    Default Value

    Uses defaults derived from output.cssModules and output.sourceMap, with importLoaders set to 1 for CSS files and 2 for Sass/Less files.

    Remarks

    The default option is as follow:

    const defaultOptions = {
      modules: {
        auto: true,
        namedExport: false,
        exportLocalsConvention: 'camelCase',
        localIdentName: output.cssModules.localIdentName,
      },
      sourceMap: output.sourceMap,
      // importLoaders is `1` when compiling css files, and is `2` when compiling sass/less files
      importLoaders: 1 || 2,
    };

    rsdoctor?

    optional rsdoctor?: RsdoctorRspackPluginOptions

    The Tools.rsdoctor controls the options of Rsdoctor.

    Default Value

    undefined

    Remarks

    Setting RSDOCTOR=true enables Rsdoctor. When it is enabled, Rspeedy merges additional plugin defaults during config normalization.

    Example

    • Use the built-in Rsdoctor.
    import { defineConfig } from '@lynx-js/rspeedy'
    
    export default defineConfig({
      tools: {
        rsdoctor: {
          disableClientServer: true,
        },
      },
    })

    See Rsdoctor - Configuration for details.


    rspack?

    optional rspack?: ToolsRspackConfig

    The Tools.rspack controls the options of Rspack.

    Default Value

    undefined

    Examples

    • Use object config
    import { defineConfig } from '@lynx-js/rspeedy'
    
    export default defineConfig({
      tools: {
        rspack: {
          resolve: {
            fullySpecified: true,
          },
        },
      },
    })

    See Rspack - Configuration for details.

    • Use function with env utils
    import { defineConfig } from '@lynx-js/rspeedy'
    
    export default defineConfig({
      tools: {
        rspack(config, { env }) {
          if (env === 'development') {
            config.devtool = 'cheap-source-map'
          }
          return config
        },
      },
    })

    See Rsbuild - tools.rspack for details.

    • Use function with mergeConfig utils
    import { defineConfig } from '@lynx-js/rspeedy'
    
    export default defineConfig({
      tools: {
        rspack(config, { mergeConfig }) {
          return mergeConfig(config, {
            resolve: {
              fullySpecified: true,
            },
          })
        },
      },
    })

    See Rsbuild - tools.rspack for details.

    • Use function with appendPlugins utils
    import { defineConfig } from '@lynx-js/rspeedy'
    
    export default defineConfig({
      tools: {
        rspack(config, { appendPlugins, rspack }) {
          appendPlugins(new rspack.BannerPlugin({ banner: 'Hello, World!' }))
          return config
        },
      },
    })

    See Rsbuild - tools.rspack for details.


    swc?

    optional swc?: ToolsSwcConfig

    The Tools.swc controls the options of builtin:swc-loader.

    Default Value

    undefined
    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.