Skip to content

Commit

Permalink
remove code
Browse files Browse the repository at this point in the history
  • Loading branch information
chenshuai2144 committed Jun 16, 2023
1 parent d16ffcc commit 4c86417
Showing 1 changed file with 1 addition and 24 deletions.
25 changes: 1 addition & 24 deletions packages/preset-umi/src/features/ssr/ssr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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: {
Expand Down

0 comments on commit 4c86417

Please sign in to comment.