From 405176d6068b6eef04e16cee39ec31c828f38dc6 Mon Sep 17 00:00:00 2001 From: gwuhaolin Date: Wed, 11 Oct 2023 17:05:51 +0800 Subject: [PATCH] =?UTF-8?q?feature:=20SSR=E6=A8=A1=E5=BC=8F=E4=B8=8B?= =?UTF-8?q?=EF=BC=8C=E5=A4=9A=E8=BE=93=E5=87=BA=E4=B8=80=E4=BB=BD=E5=92=8C?= =?UTF-8?q?index.html=E5=AE=8C=E5=85=A8=E4=B8=80=E8=87=B4=E7=9A=84*.html?= =?UTF-8?q?=E6=96=87=E4=BB=B6=EF=BC=8C=E7=94=A8=E4=BA=8EER=E5=9C=BA?= =?UTF-8?q?=E6=99=AF=20(#11723)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix: dev环境构建SSR server.js时,环境判断错误导致输出的dev产物带上了hash * Update packages/preset-umi/src/features/ssr/webpack/webpack.ts Co-authored-by: chencheng (云谦) * fix: dev环境构建SSR server.js时,环境判断错误导致输出的dev产物带上了hash * feature: 支持自定义SSR构建目标,默认为node,可配置为webworker以支持运行在类似Cloudflare Workers的平台 以解决 react-dom/server renderToReadableStream 不存在的问题 * feature: getManifest支持传入sourceDir表示SSR产物目录 * feature: getManifest支持传入sourceDir表示SSR产物目录 * fix: rendertoreadablestream is not a function * Revert "feature: 支持自定义SSR构建目标,默认为node,可配置为webworker以支持运行在类似Cloudflare Workers的平台" This reverts commit 5b0946a70121a8f5c7332e70bd0aa4da904253e8. * fix: rendertoreadablestream is not a function * Update packages/server/src/ssr.ts Co-authored-by: 咲奈Sakina <59400654+fz6m@users.noreply.github.com> * Update packages/server/src/ssr.ts Co-authored-by: 咲奈Sakina <59400654+fz6m@users.noreply.github.com> * fix: 还原g_getAssets * fix: 被执行时才调用getManifest(),避免在入口立即调用getManifest() * fix: 被执行时才调用getManifest(),避免在入口立即调用getManifest() * fix: 被执行时才调用getManifest(),避免在入口立即调用getManifest() * feature: SSR模式下,多输出一份和index.html完全一致的*.html文件,用于ER场景 * feature: SSR模式下,多输出一份和index.html完全一致的*.html文件,用于ER场景 --------- Co-authored-by: 奇风 Co-authored-by: chencheng (云谦) Co-authored-by: 咲奈Sakina <59400654+fz6m@users.noreply.github.com> --- packages/preset-umi/src/features/ssr/ssr.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/preset-umi/src/features/ssr/ssr.ts b/packages/preset-umi/src/features/ssr/ssr.ts index 2136eb37006b..6fe0e25db92f 100644 --- a/packages/preset-umi/src/features/ssr/ssr.ts +++ b/packages/preset-umi/src/features/ssr/ssr.ts @@ -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')); + }) + const pluginName = 'ProcessAssetsPlugin'; class ProcessAssetsPlugin { apply(compiler: Compiler) {