Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better error message for invalid directory import #33219

Closed
guybedford opened this issue May 3, 2020 · 0 comments
Closed

Better error message for invalid directory import #33219

guybedford opened this issue May 3, 2020 · 0 comments
Labels
esm Issues and PRs related to the ECMAScript Modules implementation.

Comments

@guybedford
Copy link
Contributor

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.

@guybedford guybedford added the esm Issues and PRs related to the ECMAScript Modules implementation. label May 3, 2020
aduh95 added a commit to aduh95/node that referenced this issue May 4, 2020
guybedford pushed a commit that referenced this issue May 16, 2020
Adds hint when module specifier is a file URL.

PR-URL: #33220
Fixes: #33219
Reviewed-By: Guy Bedford <guybedford@gmail.com>
codebytere pushed a commit that referenced this issue May 16, 2020
PR-URL: #33220
Fixes: #33219
Reviewed-By: Guy Bedford <guybedford@gmail.com>
codebytere pushed a commit that referenced this issue May 16, 2020
Adds hint when module specifier is a file URL.

PR-URL: #33220
Fixes: #33219
Reviewed-By: Guy Bedford <guybedford@gmail.com>
codebytere pushed a commit that referenced this issue Jun 7, 2020
PR-URL: #33220
Fixes: #33219
Reviewed-By: Guy Bedford <guybedford@gmail.com>
codebytere pushed a commit that referenced this issue Jun 7, 2020
Adds hint when module specifier is a file URL.

PR-URL: #33220
Fixes: #33219
Reviewed-By: Guy Bedford <guybedford@gmail.com>
codebytere pushed a commit to codebytere/node that referenced this issue Jun 9, 2020
PR-URL: nodejs#33220
Fixes: nodejs#33219
Reviewed-By: Guy Bedford <guybedford@gmail.com>
codebytere pushed a commit that referenced this issue Jun 9, 2020
Adds hint when module specifier is a file URL.

PR-URL: #33220
Fixes: #33219
Reviewed-By: Guy Bedford <guybedford@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
esm Issues and PRs related to the ECMAScript Modules implementation.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant