For AI agents: the complete documentation index is available at /zh/llms.txt, the full documentation bundle is available at /zh/llms-full.txt, and this page is available as Markdown at /zh/api/rspeedy.resolve.aliasstrategy.md.
这是开发预览网站。请访问正式文档 lynx-stack.dev

Home > @lynx-js/rspeedy > Resolve > aliasStrategy

Resolve.aliasStrategy property

Set the strategy for path alias resolution, to control the priority relationship between the paths option in tsconfig.json and the resolve.alias option of Rsbuild.

Signature:

aliasStrategy?: 'prefer-tsconfig' | 'prefer-alias' | undefined;

Default Value

'prefer-tsconfig'

Remarks

  • prefer-tsconfig (default): The paths option in tsconfig.json will take precedence over theresolve.alias option of Rsbuild. - prefer-alias: The resolve.alias option of Rsbuild will take precedence over thepaths option in tsconfig.json.

Example

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

export default defineConfig({
  resolve: {
    alias: {
      '@': './src',
    },
    aliasStrategy: 'prefer-alias',
  },
})