diff --git a/packages/preset-umi/src/features/ssr/ssr.ts b/packages/preset-umi/src/features/ssr/ssr.ts index 1d633b930289..cfd42ab0be5b 100644 --- a/packages/preset-umi/src/features/ssr/ssr.ts +++ b/packages/preset-umi/src/features/ssr/ssr.ts @@ -8,7 +8,7 @@ import assert from 'assert'; import { existsSync, writeFileSync } from 'fs'; import { join } from 'path'; import type { IApi } from '../../types'; -import { absServerBuildPath, getPreRenderedHTML } from './utils'; +import { absServerBuildPath } from './utils'; export default (api: IApi) => { const esbuildBuilder: typeof import('./builder/builder') = importLazy( @@ -18,29 +18,6 @@ export default (api: IApi) => { require.resolve('./webpack/webpack'), ); - // 如果 exportStatic 不存在的时候。预渲染一下 index.html - if (!api.config.exportStatic) { - // export routes to html files - api.modifyExportHTMLFiles(async (_defaultFiles) => { - const preRenderFils: typeof _defaultFiles = []; - for await (const file of _defaultFiles.filter( - (f) => !f.path.includes(':'), - )) { - // 只需要 index.html 就好了,404 copy 一下 index。但是最好还是开一下 exportStatic - if (file.path === 'index.html') { - const html = await getPreRenderedHTML(api, file.content, '/'); - preRenderFils.push({ - path: file.path, - content: html, - }); - } else { - preRenderFils.push(file); - } - } - return preRenderFils; - }); - } - api.describe({ key: 'ssr', config: {