-
Notifications
You must be signed in to change notification settings - Fork 47.3k
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
Add IIFE bundle for SSR instruction streaming runtime #25459
Conversation
00e84f0
to
513a715
Compare
Comparing: aa9988e...513a715 Critical size changesIncludes critical production bundles, as well as any change greater than 2%: Significant size changesIncludes any change greater than 0.2%: Expand to show |
@@ -224,6 +228,11 @@ function getFormat(bundleType) { | |||
return `cjs`; | |||
case NODE_ESM: | |||
return `es`; | |||
case IIFE_DEV: |
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 don't think it's worth having a dev build of this. It doesn't have any warnings or anything. Let's just do prod only.
@@ -1018,13 +1041,17 @@ function getOriginalFilename(bundle, bundleType) { | |||
return `${name}.production.min.js`; | |||
case NODE_PROFILING: | |||
return `${name}.profiling.min.js`; | |||
case IIFE_PROD: | |||
return `${name}.production.min.js`; |
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.
Similarly here, I don't think we should bother with the .production.min.js
stuff. We do that in our packages that are consumed by a bundler (like ES Modules or Common JS) but in this case there is no bundler, Fizz is going to inject this directly.
So let's just output the exact filename.
@@ -88,6 +94,9 @@ function getBundleOutputPath(bundleType, filename, packageName) { | |||
default: | |||
throw new Error('Unknown RN package.'); | |||
} | |||
case IIFE_DEV: | |||
case IIFE_PROD: | |||
return `build/node_modules/${packageName}/iife/${filename}`; |
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.
Similar here: let's remove the iife
subdirectory and place it directly at the top level.
${source}`; | ||
}, | ||
|
||
[IIFE_DEV](source, globalName, filename, moduleType) { |
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.
We can skip this. Remember these files are going to get sent straight to the browser with no post-processing by a bundler or minifier. Don't want the extra bytes.
? [IIFE_DEV, IIFE_PROD, FB_IIFE_DEV, FB_IIFE_PROD] | ||
: [], | ||
moduleType: RENDERER, | ||
entry: 'react-dom/instruction-streaming-runtime', |
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.
Should probably prefix this with unstable-
for now
Landed with a slightly modified approach in 54f0e0f |
(Loosely followed #25436 to find what changes to make)
We're adding an option to Fizz to support an alternate output format that doesn't rely on inline script tags (see #25437). Part of this change involves publishing a minimal client runtime to observe and process SSR instructions.
This PR adds a new bundle "instruction-streaming-runtime", which will be compiled to an IIFE.
instruction-streaming-runtime
will be published by React and be a standalone script that installs this minimal client runtimeruntimeSrc
param if theenableFizzNoScriptExecution
is toggled (in SSR entrypoints params). We expect clients to pass a url to theinstruction-streaming-runtime
bundle here.