Skip to content

Tsbuild watching packagejson is dependent on whether program was built in the invocation #48314

Open

Description

With tsc --build we watch input files, config files and output file timestamps to determine if we need to rebuild or not. In past we never checked for module resolution and related files and their timestamps and requiring users to either force build if all inputs and outputs are UpToDate with only change to module resolution related changed. Eg node_modules/@types/someType/packge.json say exports or imports map or types entry changes.

Recently in anticipation to nodenext resolution changes we added package.json also as part of list of files to check timestamps on. But since it cannot be derived without having program constructed, it meant that we only watch/check their timestamps when we construct program. This means we benefit from this only in watch scenario and that too if program was constructed.

So here are two questions:

  1. Do we really need to watch/timestamp check package.json as now it could change fields that affect the module resolution
  2. If we need to treat package.json can we use heuristics or do we need fields. Note that we could store this list in buildinfo but then non incremental programs will have the same issue as there wont be buildinfo to read from?
    Options for package.json detection:
    a. package.json next to your own tsconfig, and next to any config referenced in references section?
    b. @RyanCavanaugh suggested packagejson entry in the tsconfig
    c. references section allows packge.json but are we allowing tsconfig options in package.json then?

Originally posted by @sheetalkamat in #44935 (comment)

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

Metadata

Assignees

Labels

Fix AvailableA PR has been opened for this issueNeeds InvestigationThis issue needs a team member to investigate its status.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions