-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
SSR 的 getManifest()支持req时传入sourceDir表示SSR产物目录 #11715
Conversation
Co-authored-by: chencheng (云谦) <[email protected]>
以解决 react-dom/server renderToReadableStream 不存在的问题
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 1 Ignored Deployment
|
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## master #11715 +/- ##
==========================================
+ Coverage 28.93% 28.94% +0.01%
==========================================
Files 485 485
Lines 14771 14765 -6
Branches 3498 3497 -1
==========================================
Hits 4274 4274
+ Misses 9737 9731 -6
Partials 760 760
☔ View full report in Codecov by Sentry. |
Co-authored-by: 咲奈Sakina <[email protected]>
Co-authored-by: 咲奈Sakina <[email protected]>
@@ -24,6 +24,7 @@ interface CreateRequestHandlerOptions { | |||
helmetContext?: any; | |||
ServerInsertedHTMLContext: React.Context<ServerInsertedHTMLHook | null>; | |||
withoutHTML?: boolean; | |||
sourceDir?: string; |
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.
看起来这里需要注释注明一下 sourceDir
是给 serverless 函数 create handler 专门用的,因为 esbuild 用到的 g_getAssets
没法传 sourceDir
:
global.g_getAssets = (fileName) => {
let m = typeof manifest === 'function' ? manifest() : manifest;
return m.assets[fileName];
};
// 生产环境这里的 manifest 就没有机会传参数了
const manifest = {{{ env }}} === 'development' ? getManifest : getManifest();
// ...
// ↓ 人工 create handler 才可以传 sourceDir
manifest: getManifest,
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.
interface CreateRequestHandlerServerlessOptions {
/** 注释 */
withoutHTML?: boolean;
/** 注释 */
sourceDir?: string;
}
interface CreateRequestHandlerOptions extends CreateRequestHandlerServerlessOptions {
// ...
}
No description provided.