GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — loader: return package format from defaultResolve if known by dygabo · Pull Request #40980 · nodejs/node Conversation
|
|
@nodejs/loaders |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
If the goal is to return the format “if known,” this edge case strikes me as a clue that perhaps the logic here is wrong or incomplete; that maybe the format isn’t actually known for certain conditions. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
my interpretation here was that maybe the package.json of highlight.js should not define the type in its is that scenario correct from the package implementation side? removing the for the case: "type": "commonjs", [...] "exports": { ".": { "require": "./lib/index.js", "import": "./es/index.js" }, and is in this case the correct result "module" in case of import? If that is the case it might be that there is a bug in defaultResolve for this case even without the changes in this PR since it solves to "commonjs" (I could look into it if needed). that is not sent out and please let me know how to proceed. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
The Node.js docs recommends to always set the Lines 80 to 84 in e31d1cb
Footnotes
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Thanks for the tips. I updated the PR with one commit considering your input. I also added an additional testcase to All the tests are green and I look forward to hearing your thoughts on this. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Seems fine to me pending, a comment in the test case explaining what is going on regarding 2 package.json files might help though since it is rather hard to read.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
I added now a comment to the source file explaining the test scenario and also check the returned url value: 022a2eb |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
I'm not sure I understand this change, it looks like the added |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
it actually has an effect on the behaviour of |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Could you add a test that doesn't use |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Cool, thanks for this!
Custom resolve hooks can already return an optional format property, so this makes sense to me. I think there wasn't a particular reason we did not already update defaultResolve() to do this—I think maybe we were planning to do in a follow-up (so the original PR, that was already getting quite large, could land) and @dygabo got to it first 🙂
Approach and goal look good to me. Just a few hygiene nits.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
I cannot make a unit-test without the expose-internals in this case but I think it is explained by @JakobJingleheimer : please let me know if that clarifies the use-case |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Sure you can. For example, you could check that
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
review comments solved with: 3894a73 |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
thank you for the hint. If this would serve the purpose of you understanding the modification I would try to squeeze in some more tome for this next week. I thought the comment of @JakobJingleheimer explained it quite well and your question would be clarified by that. Apart from that since I also am kind of on a tight schedule I would skip it as IMO the automated test with Please all let me know your thoughts on this. If the additional testcase is needed I will find an evening in the upcoming week for that. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Backport PR for |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
This is a proposed modification of defaultResolve to return the package format in case it has been found during package resolution. The format will be returned as described in the documentation: https://nodejs.org/api/esm.html#resolvespecifier-context-defaultresolve There is one new unit test as well: test/es-module/test-esm-resolve-type.js PR-URL: #40980 Reviewed-By: Bradley Farias <[email protected]> Reviewed-By: Gerhard Stöbich <[email protected]> Reviewed-By: Antoine du Hamel <[email protected]> Backport-PR-URL: #41752
this commit solves a regression introduced with PR-40980. if a resolve call results in a script with .mjs extension the is automatically set to . This avoids the case where an additional in the same directory as the .mjs file would declare the to commonjs PR-URL: #41218 Refs: #40980 Refs: yargs/yargs#2068 Reviewed-By: Guy Bedford <[email protected]> Reviewed-By: Antoine du Hamel <[email protected]> Reviewed-By: James M Snell <[email protected]> Backport-PR-URL: #41752
This is a proposed modification of defaultResolve to return the package format in case it has been found during package resolution. The format will be returned as described in the documentation: https://nodejs.org/api/esm.html#resolvespecifier-context-defaultresolve There is one new unit test as well: test/es-module/test-esm-resolve-type.js PR-URL: nodejs#40980 Reviewed-By: Bradley Farias <[email protected]> Reviewed-By: Gerhard Stöbich <[email protected]> Reviewed-By: Antoine du Hamel <[email protected]> Backport-PR-URL: nodejs#41752
this commit solves a regression introduced with PR-40980. if a resolve call results in a script with .mjs extension the is automatically set to . This avoids the case where an additional in the same directory as the .mjs file would declare the to commonjs PR-URL: nodejs#41218 Refs: nodejs#40980 Refs: yargs/yargs#2068 Reviewed-By: Guy Bedford <[email protected]> Reviewed-By: Antoine du Hamel <[email protected]> Reviewed-By: James M Snell <[email protected]> Backport-PR-URL: nodejs#41752
This is a proposed modification of defaultResolve to return the package format in case it has been found during package resolution. The format will be returned as described in the documentation: https://nodejs.org/api/esm.html#resolvespecifier-context-defaultresolve There is one new unit test as well: test/es-module/test-esm-resolve-type.js PR-URL: #40980 Reviewed-By: Bradley Farias <[email protected]> Reviewed-By: Gerhard Stöbich <[email protected]> Reviewed-By: Antoine du Hamel <[email protected]> Backport-PR-URL: #41752 Reviewed-By: Danielle Adams <[email protected]> Reviewed-By: Geoffrey Booth <[email protected]>
this commit solves a regression introduced with PR-40980. if a resolve call results in a script with .mjs extension the is automatically set to . This avoids the case where an additional in the same directory as the .mjs file would declare the to commonjs PR-URL: #41218 Refs: #40980 Refs: yargs/yargs#2068 Reviewed-By: Guy Bedford <[email protected]> Reviewed-By: Antoine du Hamel <[email protected]> Reviewed-By: James M Snell <[email protected]> Backport-PR-URL: #41752 Reviewed-By: Danielle Adams <[email protected]> Reviewed-By: Geoffrey Booth <[email protected]> Reviewed-By: Gerhard Stöbich <[email protected]>
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.