-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Correctly read rawRequest for frontend ESM #31917
Conversation
Size Change: -2.85 kB (0%) Total Size: 1.62 MB
ℹ️ View Unchanged
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment about the 0 B size of build/navigation/index.js
in #31917 (comment) is concerning and should be further investigated.
// being present in `entryModule.rawRequest`. | ||
// In the context of frontend files, they would be processed | ||
// as ESM if they use `import` or `export` within it. | ||
const request = rootModule?.rawRequest || rawRequest; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see it bring backs the handling for rawRequest
removed in #30341.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It does. It interesting because I removed it as it seemed to be a legacy way of handling modules of a different kind, shown by the fact that checksumming builds made with or without the change rendered the same result — every source file was being built into the same path structure regardless of its type.
The check becomes necessary again when building modules into arbitrary directories by using rawRequest
as a starting point.
I can confirm that this fixes #31909 for the use-case I have put it towards. |
That file is what was being built incorrectly instead of the In the reported case, the problem was caused by |
Cool, it looks like everything is on track. Thank you for sharing more details. Does this branch need a rebase? The failing unit tests look completely unrelated. |
e1573a7
to
2eb0057
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍🏻 Let's merge once GitHub actions turn green.
a7a6d37
to
adb9773
Compare
adb9773
to
29cbf7d
Compare
Thank you for the change in the script that builds the zip file 💯 Let's get this in when CI finishes. |
29cbf7d
to
03ddda4
Compare
Cherry-picked into the 10.7 release branch. |
Description
Fixes #31909
Fixes #32050
When processing ESM files, the requested path is defined in
entryModule.rootModule.rawRequest
, instead of being present inentryModule.rawRequest
.In the context of frontend files, they would be processed as ESM if they use
import
orexport
within it.This issue is not being flagged by the e2e pipeline, which indicates it might be dependant on the environment somehow. For example, I can reproduce this in my system by running
npm run build
but if I usenpm run dev
, everything is built correctly. e2e tests are ran on the production build, so I'm not entirely sure where the difference actually is.