For AI agents: the complete documentation index is available at /next/zh/llms.txt, the full documentation bundle is available at /next/zh/llms-full.txt, and this page is available as Markdown at /next/zh/api/rspeedy/rspeedy.tools.rspack.md.
Rspeedy logo
Rspeedy
  • 简体中文
  • 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.

    除非另有说明,本项目采用知识共享署名 4.0 国际许可协议进行许可,代码示例采用 Apache License 2.0 许可协议进行许可。