-
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
feature: SSR模式下,多输出一份和index.html完全一致的*.html文件,用于ER场景 #11723
Conversation
gwuhaolin
commented
Oct 11, 2023
•
edited
Loading
edited
Co-authored-by: chencheng (云谦) <[email protected]>
以解决 react-dom/server renderToReadableStream 不存在的问题
… Workers的平台" This reverts commit 5b0946a.
Co-authored-by: 咲奈Sakina <[email protected]>
Co-authored-by: 咲奈Sakina <[email protected]>
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 #11723 +/- ##
==========================================
- Coverage 28.94% 28.94% -0.01%
==========================================
Files 485 485
Lines 14765 14767 +2
Branches 3497 3498 +1
==========================================
Hits 4274 4274
- Misses 9731 9733 +2
Partials 760 760
☔ View full report in Codecov by Sentry. |
@@ -145,6 +145,11 @@ export default function handler(request, response) { | |||
} | |||
}); | |||
|
|||
api.onBuildHtmlComplete(() => { | |||
// SSR模式下,多输出一份和index.html完全一致的*.html文件,用于ER场景 | |||
fsExtra.copyFileSync(join(api.paths.absOutputPath, 'index.html'), join(api.paths.absOutputPath, '*.html')); |
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.
这个地方非常不清真。
-
首先这是用户非预期的文件,我们不应该生成大部分用户不需要的文件,这部分特定于 serverless 的可以做到 bigfish 里或者单独的 serverless plugin 或 preset 里去,而不应该污染源代码库造成所有人都有这个副作用。
-
其次有的人可能对 html 产物做了修改,这里复制了
index.html
其实用户会得到两个不一样的 html 产物,会造成非常大的疑惑,是黑盒。 -
另外标准存在不一致,社区内对于 404 fallback 的默认行为是 找不到会使用
404.html
,而这里是*.html
,不符合社区共识。
改进意见
- 做到 bigfish 中或内部自己的 serverless umi plugin or preset 中,不要污染 umi 代码仓库造成所有人的副作用和非预期黑盒产物。
或
- 新增选项
ssr: { er: true }
选项来开启这个生成功能,以后所有的副作用做到这个选项开启内。