-
-
Notifications
You must be signed in to change notification settings - Fork 0
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
Failed to resolve 'dunder-proto/get' from './node_modules/get-intrinsic/index.js' #2
Comments
It seems like a parcel bug ( |
We are having the same issue. Setting |
npm's docs aren't relevant, since it's always been accepted by node. The error on Parcel is flatly incorrect. There's been lots of working resolution implementations for over a decade - primarily https://npmjs.com/resolve - so if a tool decides to rewrite it from scratch, it's incumbent on them to look at existing implementations and not just the docs. |
What is the meaning/purpose of setting main to false? |
So that |
I see, that makes sense. I asked an AI about different ways to do this and one suggestion was to point to an existing file that throws an error. One advantage would be that you can control the error message. If you could find a solution that has both a clear semantics and works well with bundlers that would be very helpful to us and I think the community at large. Also, thank you for your open source work! |
I could definitely make that change - but the only bundler that seems to be broken here is parcel, and I'd hate to worsen the ecosystem by working around it rather than trying to push parcel to fix itself. Have you filed an issue with them? |
Ok, I will create an issue on parcel. Do you know of a good source that I can refer to where the correct semantics of the main filed is described? |
I mean, in this case nothing's actually trying to import the |
Is that documented in the node docs? I'm all for getting them to do the right thing but it would help to be able to refer to something |
https://nodejs.org/api/modules.html#all-together is the algorithm. Specifically:
meaning it supports any falsy value, and the next steps stringify any truthy value. |
A different location of the node docs says: "The "main" field defines the entry point of a package when imported by name via a node_modules lookup. Its value is a path." So there is an incompatibility in the node docs. You are relying on one statement and the Parcel team is relying on another |
Right. Which is why the docs never matter more than the actual implementation, for which |
yes, the jsonschema that vscode uses for package.json is also incorrect, sadly. |
Oh come on. Why is this necessary? You could just remove the main field entirely from your package. That would have the exact same effect without breaking compatibility. There's no reason to set it to |
@devongovett it's a standard thing that's in numerous packages throughout the ecosystem. It seems like Parcel not doing what npm has always done is the thing that's wasted the most time here? Removing the main field is not the same - that defaults to |
It is now that you've done it. We've never had this issue come up before.
That's not true. Following the algorithm you posted above:
|
@devongovett i'm not the first one to do it; as i said, this is how node itself, and the ecosystem, has always worked. That it's never come up before just means the overlap of "someone using parcel" and "someone using a package that does this somewhere in their graph" hasn't occurred before. yes - "GOTO 2" then does "LOAD_INDEX". meaning it defaults to This is all empirically observable in every version of node that's ever existed, as well as |
right, exactly what removing the main field would do.
As I said, I'm gonna fix it but this is silly. |
As long as it gets fixed, that's fine. Your belief in what's silly is unfortunately irrelevant, because the ecosystem works the way it works ¯\_(ツ)_/¯ I'd strongly suggest auditing your resolution algorithm and comparing it to node itself, just to make sure there's no additional issues and that this isn't a brown m&m. |
Seems like this is somewhat fixed in parcel-bundler/parcel#10053, so I'll close this. |
Thank you. Updated to parcel@2.13.3 and and it works. |
It appears that In the case of this package, if preserving support for older versions of Nodejs is important, the Nodejs follows this resolution circuit lazily for
So |
@alshdavid even in node versions that predate |
Works how? as in it falls back to Looking at node 12, the behaviour is the same as node 22:
The type that |
Yes, that's what I'm saying, it works in that it falls back to the (nonexistent) What is technically correct is that the type doesn't matter - so, despite a number of places documenting it as a string, in fact it can be literally any kind of JSON value, and since there's semantic value and quite a bit of precedent for packages using |
Yeah I see your point. Bundler resolvers should probably take this into account. Essentially, setting That said, this package doesn't have an |
Correct, it doesn't, because I don't want this package to unintentionally have a |
Facing this error -> Failed to resolve 'dunder-proto/get' from './node_modules/get-intrinsic/index.js'
here is the line it fails at ->
var getDunderProto = require('dunder-proto/get');
Which is part of third party get-intrinsic module.
Any idea how can I fix this?
The text was updated successfully, but these errors were encountered: