-
Notifications
You must be signed in to change notification settings - Fork 29.7k
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
[ES modules] package.json located in root path can't be resolved when checking type
field
#33438
Labels
confirmed-bug
Issues with confirmed bugs.
esm
Issues and PRs related to the ECMAScript Modules implementation.
module
Issues and PRs related to the module subsystem.
Comments
vitalets
changed the title
When
[ES modules] package.json located in root path can't be resolved when checking May 16, 2020
type
field
/cc @nodejs/modules-active-members |
Yes this looks like a bug to me, we should support a type at the root. PRs to fix welcome, although understood testing might be an issue! |
3 tasks
GeoffreyBooth
added
confirmed-bug
Issues with confirmed bugs.
esm
Issues and PRs related to the ECMAScript Modules implementation.
module
Issues and PRs related to the module subsystem.
labels
May 20, 2020
Merged
nodejs-github-bot
pushed a commit
that referenced
this issue
Aug 15, 2020
This patch converts the "read package scope" algorithm's while loop into a do-while loop enabling items at the filesystem root dir to be considered within the scope of a sibling package.json also at the filesystem root dir. Fixes: #33438 Co-authored-by: Guy Bedford <guybedford@gmail.com> PR-URL: #34595 Reviewed-By: Jan Krems <jan.krems@gmail.com> Reviewed-By: Mary Marchini <oss@mmarchini.me>
MylesBorins
pushed a commit
that referenced
this issue
Aug 17, 2020
This patch converts the "read package scope" algorithm's while loop into a do-while loop enabling items at the filesystem root dir to be considered within the scope of a sibling package.json also at the filesystem root dir. Fixes: #33438 Co-authored-by: Guy Bedford <guybedford@gmail.com> PR-URL: #34595 Reviewed-By: Jan Krems <jan.krems@gmail.com> Reviewed-By: Mary Marchini <oss@mmarchini.me>
BethGriggs
pushed a commit
that referenced
this issue
Aug 20, 2020
This patch converts the "read package scope" algorithm's while loop into a do-while loop enabling items at the filesystem root dir to be considered within the scope of a sibling package.json also at the filesystem root dir. Fixes: #33438 Co-authored-by: Guy Bedford <guybedford@gmail.com> PR-URL: #34595 Reviewed-By: Jan Krems <jan.krems@gmail.com> Reviewed-By: Mary Marchini <oss@mmarchini.me>
guybedford
pushed a commit
to guybedford/node
that referenced
this issue
Sep 28, 2020
This patch converts the "read package scope" algorithm's while loop into a do-while loop enabling items at the filesystem root dir to be considered within the scope of a sibling package.json also at the filesystem root dir. Fixes: nodejs#33438 Co-authored-by: Guy Bedford <guybedford@gmail.com> PR-URL: nodejs#34595 Reviewed-By: Jan Krems <jan.krems@gmail.com> Reviewed-By: Mary Marchini <oss@mmarchini.me>
codebytere
pushed a commit
that referenced
this issue
Oct 1, 2020
This patch converts the "read package scope" algorithm's while loop into a do-while loop enabling items at the filesystem root dir to be considered within the scope of a sibling package.json also at the filesystem root dir. Fixes: #33438 Co-authored-by: Guy Bedford <guybedford@gmail.com> PR-URL: #34595 Backport-PR-URL: #35385 Reviewed-By: Jan Krems <jan.krems@gmail.com> Reviewed-By: Mary Marchini <oss@mmarchini.me>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
confirmed-bug
Issues with confirmed bugs.
esm
Issues and PRs related to the ECMAScript Modules implementation.
module
Issues and PRs related to the module subsystem.
v14.2.0
Linux c89b7c439bd7 4.19.76-linuxkit #1 SMP Fri Apr 3 15:53:26 UTC 2020 x86_64 Linux
What steps will reproduce the bug?
Create docker image that generates
package.json
andindex.js
in root of filesystem:Build and run the container:
docker build -t app . docker run --rm app
Output:
How often does it reproduce? Is there a required condition?
Always.
What is the expected behavior?
index.js
should be loaded as es module because the nearestpackage.json
has"type": "module"
field.What do you see instead?
index.js
is being loaded as commonjs.Additional information
If
package.json
andindex.js
are generated in some subdirectory - everything works. You can check it with the following image:The reason of such behavior is this line:
When
checkPath = '/index.js'
, bothseparatorIndex
androotSeparatorIndex
are equals to0
and condition does not pass.The text was updated successfully, but these errors were encountered: