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/rspeedy/rspeedy.tools.rspack.md.
Rspeedy logo
Rspeedy
  • English
  • Home > @lynx-js/rspeedy > Tools > rspack

    Tools.rspack property

    The Tools.rspack controls the options of Rspack.

    Signature:

    rspack?: ToolsConfig['rspack'] | undefined;

    Default Value

    undefined

    Example 1

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

    See Rspack - Configuration for details.

    Example 2

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

    Example 3

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

    Example 4

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

    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.