Skip to content

Move away from Classic module resolution as default for all module kinds #11434

@DanielRosenwasser

Description

@DanielRosenwasser

TypeScript's original module resolution strategy (the Classic resolution strategy) has some strange behavior that apparently doesn't actually reflect any other resolution strategy. It seems strange that those using non-CommonJS emit targets get this behavior by default.

Classic resolution also causes many disk probes during the walk up the project root - assuming that this strategy does eventually succeed in most cases, it seems like most uses could be subsumed by:

  • Using relative paths.
  • Modifying the baseUrl and paths properties in tsconfig.json.

After discussing with @vladima, we think it is worth considering switching the default resolution strategy for all module targets to Node.

Here's what needs to be done:

  • Investigate existing tsconfig.jsons that target esXXXX` and have no explicit/implied resolution strategy.
  • Determine the downstream effects to a change to defaults
  • Determine if this change outweighs the potential breakage
  • Implement if appropriate

Metadata

Metadata

Assignees

No one assigned

    Labels

    CommittedThe team has roadmapped this issueEffort: ModerateRequires experience with the TypeScript codebase, but feasible. Harder than "Effort: Casual".Help WantedYou can do thisSuggestionAn idea for TypeScript

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions