Skip to content

Provide better errors on module: node12 and extensionless imports #46152

Closed
@DanielRosenwasser

Description

@DanielRosenwasser

When an extensionless import fails from an ES module when moduleResolution is effectively node12/nodenext, we currently issue a useless error message.

// @filename: ./foo.mts
export function foo() {
}

// @filename: ./bar.mts
import foo from "./foo";
// error: Cannot find module './foo' or its corresponding type declarations.

Instead, we should see if we managed to find any files with an extension, or at least mention that an extensionless import is likely to fail.

Metadata

Metadata

Assignees

Labels

Domain: Error MessagesThe issue relates to error messagingEffort: ModerateRequires experience with the TypeScript codebase, but feasible. Harder than "Effort: Casual".Fix AvailableA PR has been opened for this issueHelp WantedYou can do thisSuggestionAn idea for TypeScript

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions