Skip to content

[Bug]: BuildDependencies: can't resolve for TS imports #12241

@Armine-i

Description

@Armine-i

System Info

System:
  OS: macOS 15.6 (Darwin 24.6.0)
  CPU: ARM64 (Apple Silicon)

Binaries:
  Node: v20.18.0
  npm: 10.8.2

Relevant packages:
  @rspack/cli: ^1.1.8
  @rspack/core: ^1.1.8
  typescript: ^5.7.2
  ts-node: ^10.9.2

Details

When using Rspack's experimental persistent cache feature with TypeScript configuration files, the build logs a warning about being unable to resolve relative imports within the config directory:

LOG from rspack.persistentCache
<w> BuildDependencies: can't resolve ./util in /Users/airadian/rspack-repro/rspack.
<w> - NotFound("./util")

This occurs even though:

  1. The TypeScript import (import { BogusPlugin } from './util';) works correctly in rspack/rspack.config.ts
  2. The build completes successfully
  3. The file rspack/util.ts exists and is valid

The warning appears when:

  • Running the first build with no cache
  • After clearing the cache directory (node_modules/.rspack) and re-running it

Reproduce link

https://github.com/Armine-i/rspack-repro/tree/mina-repro

Reproduce Steps

git clone https://github.com/Armine-i/rspack-repro.git
cd rspack-repro
npm install
rm -rf node_modules/.rspack
npm run build

The warning will appear in the console output.

Important: It only logs when there's no cache or if it's invalidated. Run rm -rf node_modules/.rspack before building to reproduce.

Expected Behavior

The persistent cache's buildDependencies feature should correctly resolve TypeScript relative imports (e.g., ./util) within the tracked directory without logging warnings.

Actual Behavior

A NotFound("./util") warning is logged during the build, suggesting the cache system cannot resolve the TypeScript import even though the file exists and TypeScript compilation succeeds.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions