Skip to content

perf: resolution throws+catches an ENOENT per missing path (tryStatSync in bundled import-meta-resolve) #474

Closed

Description

@Sager611

jiti's bundled copy of import-meta-resolve (via mlly) has tryStatSync() that calls statSync(path) in try/catch, so every probed non-existent path allocates an ENOENT error with a stack trace. Measured on jiti 2.7.0 loading 10 TS extensions: 530 thrown stats; with a 40-extension setup: 2304 thrown stats (~50 ms CPU per process start). Switching to statSync(path, {throwIfNoEntry:false}) removes all but 1/27. Fix proposed upstream in the source package: wooorm/import-meta-resolve#37 ; once released, mlly/jiti only need a dependency bump (jiti has no tryStatSync in src/). Local patch used meanwhile: same one-line change in dist/jiti.cjs.

Activity

  1. pi0 commented on Oct 8, 2026

    @pi0
    Member

    we could likely migrate to https://github.com/unjs/exsolve instead. feel free to check if it solves issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions