Skip to content

TS server significantly slower to initialize when includePackageJsonAutoImports is auto #60854

@OliverJAsh

Description

@OliverJAsh

🔎 Search Terms

  • monorepo
  • project references
  • package exports
  • subpath exports
  • includePackageJsonAutoImports
  • paths

🕗 Version & Regression Information

  • This is the behavior in every version I tried, and I reviewed the FAQ for entries about auto imports.

⏯ Playground Link

No response

💻 Code

My large work project became significantly slower to initialize in VS Code after we migrated from paths in tsconfig.json to exports in package.json (6s before, 12s after).

I dug into the TS server log and noticed AutoImportProvider was now including many more files than before (2474 before, 8442 after).

This led me to typescript.preferences.includePackageJsonAutoImports, which I understand defaults to auto. When I set it to off, initialization time decreases from 12s back down to 6s. Note this doesn't seem to affect the functionality of auto imports.

I can't imagine this would be expected behaviour: 6s of extra initialization with no noticeable gain in functionality.

Unfortunately I can't share a reduced test case for this, but I would be happy to do further debugging if someone could give me guidance.

For context, this project is a monorepo with multiple packages depending on each other. We are also utilizing project references (each package has its own project). The package exports includes many entries.

🙁 Actual behavior

N/A

🙂 Expected behavior

N/A

Additional information about the issue

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs More InfoThe issue still hasn't been fully clarified

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions