Uh oh!
There was an error while loading. Please reload this page.
esm: fix esm load bug - #25491
Conversation
guybedford
commented
Jan 14, 2019
Unfortunately we can't just override the module map - it has to be treated as an immutable map otherwise we can possibly get race conditions in loading / different instances. The fix here has to be to ensure the onReady function is available as soon as the moduleMap entry is set. |
guybedford
commented
Jan 14, 2019
(or change the architecture to not need an onReady) |
ZYSzys
commented
Jan 14, 2019
So how should this to be fixed specifically ?Can you please give me some more guides ? I've changed it like we previously did: https://github.com/nodejs/node/pull/24560/files#diff-76195ce57689942222a27f0dbda6d3b7L641 Sincerely /cc @devsnek who actual implement the refactor in #24560 (comment) |
devsnek
commented
Jan 14, 2019
lite ci run to see if this fix passes https://ci.nodejs.org/job/node-test-pull-request-lite-pipeline/2243/ |
guybedford
commented
Jan 14, 2019
devsnek
commented
Jan 14, 2019
the current change passes all tests, so maybe we're on to something? cc @bmeck for some hopeful insight |
Uh oh!
There was an error while loading. Please reload this page.
guybedford
commented
May 12, 2019
So the problem here is that the CJS cache injects into the ESM loader so they share the same instances, but in the case where the ESM loader has already loaded the module, the CJS version should not override the existing ESM version. So the fix is correct. I've merged the test case from #27443 into this PR, and can confirm it is fully resolved. Please lets land this soon and backport the patch as well. |
This comment has been minimized.
This comment has been minimized.
Trott
left a comment
There was a problem hiding this comment.
LGTM, but I'd prefer we cherry-pick or am in the test to preserve authorship for the contributor who wrote it, unless there's a good reason not to do that.
This test shows the regression introduced in v11.4.0: clearing out the require.cache crashes node when using the `--experimental-modules` flag. Refs: #25482
ZYSzys
commented
May 13, 2019
@Trott I've |
This comment has been minimized.
This comment has been minimized.
nodejs-github-bot
commented
May 13, 2019
guybedford
commented
May 13, 2019
Thanks @ZYSzys for updating that - of course we should retain the original commit. |
This test shows the regression introduced in v11.4.0: clearing out the require.cache crashes node when using the `--experimental-modules` flag. Refs: #25482 PR-URL: #25491 Reviewed-By: Guy Bedford <guybedford@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
Landed in 523a9fb...ac3b98c @aduh95 Thanks and congratulate for your |
This test shows the regression introduced in v11.4.0: clearing out the require.cache crashes node when using the `--experimental-modules` flag. Refs: #25482 PR-URL: #25491 Reviewed-By: Guy Bedford <guybedford@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
This test shows the regression introduced in v11.4.0: clearing out the require.cache crashes node when using the `--experimental-modules` flag. Refs: #25482 Backport-PR-URL: #27874 PR-URL: #25491 Reviewed-By: Guy Bedford <guybedford@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
Fixes: nodejs/node#25482 PR-URL: nodejs/node#25491 Reviewed-By: Guy Bedford <guybedford@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
This test shows the regression introduced in v11.4.0: clearing out the require.cache crashes node when using the `--experimental-modules` flag. Refs: nodejs/node#25482 PR-URL: nodejs/node#25491 Reviewed-By: Guy Bedford <guybedford@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
Ifmodule.reflectisundefined, just run intoelsecondition.Fixes: #25482
Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passes