镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

Better error message for invalid directory import #33219

Description

@guybedford

The following test case was brought up by @addaleax

esm.mjs:

import mod from './';

console.log(mod);

where node esm.mjs fails with

TypeError [ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension "" for /tmp/test/
    at Loader.defaultGetFormat [as _getFormat] (internal/modules/esm/get_format.js:65:15)

We should ensure the error message here provides the correct steps to resolve the issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    esmIssues and PRs related to the ECMAScript Modules implementation.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions