Home > @lynx-js/rspeedy > Tools > rspack

Tools.rspack property

The Tools.rspack controls the options of Rspack.

Signature:

rspack?: ToolsConfig['rspack'] | 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 许可协议进行许可。