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.resolve.dedupe.md.
Rspeedy logo
Rspeedy
  • 简体中文
  • Home > @lynx-js/rspeedy > Resolve > dedupe

    Resolve.dedupe property

    Force to resolve the specified packages from project root, which is useful for deduplicating packages and reducing the bundle size.

    Signature:

    dedupe?: string[] | undefined;

    Default Value

    undefined

    Remarks

    Resolve.dedupe is implemented based on Resolve.alias, it will get the path of the specified package through require.resolve in the project root directory and set it to the alias.

    The alias generated by Resolve.dedupe will be merged with the configured Resolve.alias in the project, and the Resolve.alias config will take precedence when the keys are the same.

    Example

    Use tslib from the project root directory.

    import { defineConfig } from '@lynx-js/rspeedy'
    
    export default defineConfig({
      resolve: {
        dedupe: ['tslib'],
      },
    })
    除非另有说明,本项目采用知识共享署名 4.0 国际许可协议进行许可,代码示例采用 Apache License 2.0 许可协议进行许可。