> For AI agents: the complete documentation index is available at /llms.txt, the full documentation bundle is available at /llms-full.txt.

# resolve

Options for module resolution.

## resolve.aliasStrategy [![resolve.aliasStrategy](https://assets.rspack.rs/rsbuild/rsbuild-logo.svg)resolve.aliasStrategy](https://rsbuild.rs/config/resolve/alias-strategy)
Control the priority between the `resolve.alias` option and the `paths` option in `tsconfig.json`.

## resolve.alias [![resolve.alias](https://assets.rspack.rs/rsbuild/rsbuild-logo.svg)resolve.alias](https://rsbuild.rs/config/resolve/alias)
Set the alias for the module path, which is used to simplify the import path or redirect the module reference, similar to the [resolve.alias](https://rspack.rs/config/resolve#resolvealias) config of Rspack.

For TypeScript projects, you only need to configure [compilerOptions.paths](https://www.typescriptlang.org/tsconfig/#paths) in the `tsconfig.json` file. Rstest will automatically recognize it, so there is no need to configure the `resolve.alias` option separately.

## resolve.dedupe [![resolve.dedupe](https://assets.rspack.rs/rsbuild/rsbuild-logo.svg)resolve.dedupe](https://rsbuild.rs/config/resolve/dedupe)
Force Rstest to resolve the specified packages from project root, which is useful for deduplicating packages and reducing the bundle size.

## resolve.extensions [![resolve.extensions](https://assets.rspack.rs/rsbuild/rsbuild-logo.svg)resolve.extensions](https://rsbuild.rs/config/resolve/extensions)
Automatically resolve file extensions when importing modules. This means you can import files without explicitly writing their extensions.

## resolve.conditionNames [![resolve.conditionNames](https://assets.rspack.rs/rsbuild/rsbuild-logo.svg)resolve.conditionNames](https://rsbuild.rs/config/resolve/condition-names)
Control the condition names used when resolving the `exports` field of a package.

**Default:** Depends on the test environment and dependency type.

For `node`, `jsdom`, and `happy-dom` tests, Rstest inherits Rspack's default conditions. With the default `NODE_ENV=test`, bundled JavaScript dependencies use:

| Test environment      | ESM `import`                                                    | CommonJS `require`                                               |
| --------------------- | --------------------------------------------------------------- | ---------------------------------------------------------------- |
| `node`                | `import`, `module`, `webpack`, `development`, `node`            | `require`, `module`, `webpack`, `development`, `node`            |
| `jsdom` / `happy-dom` | `browser`, `import`, `module`, `webpack`, `development`, `node` | `browser`, `require`, `module`, `webpack`, `development`, `node` |

Rstest treats `NODE_ENV=test` as development mode for bundling, so `development` is active even though `NODE_ENV` is `'test'`. The package's `exports` key order determines which matching entry wins, rather than the order of `conditionNames`.

When customizing this option, use `'...'` to preserve Rspack's default conditions. For example, use `conditionNames: ['custom', '...']` in `node` tests, or `conditionNames: ['browser', 'custom', '...']` in `jsdom` / `happy-dom` tests. When this option is set explicitly, Rstest no longer adds `browser` automatically.

Providing a list without `'...'` replaces the defaults across dependency types, including the distinction between `import` and `require`.

To remove a default condition while keeping separate ESM and CommonJS resolution, configure `tools.rspack.resolve.byDependency`. See the [Jest migration example](/guide/migration/jest.md#dependency-export-conditions), which excludes `development` and explains when to include `browser`.

## resolve.mainFields [![resolve.mainFields](https://assets.rspack.rs/rsbuild/rsbuild-logo.svg)resolve.mainFields](https://rsbuild.rs/config/resolve/main-fields)
Control the priority order of package entry fields such as `main`, `module`, and `browser`.
