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;

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'],
  },
})
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.