Skip to content

Commit

Permalink
fix(preset-umi): delay import ssr builder, Close umijs#8202
Browse files Browse the repository at this point in the history
  • Loading branch information
sorrycc committed Jun 24, 2022
1 parent 3d636be commit 8a5a062
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/preset-umi/src/features/ssr/ssr.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import type { Compiler } from '@umijs/bundler-webpack/compiled/webpack';
import { EnableBy } from '@umijs/core/dist/types';
import { fsExtra, logger } from '@umijs/utils';
import { fsExtra, importLazy, logger } from '@umijs/utils';
import { existsSync, writeFileSync } from 'fs';
import { join } from 'path';
import type { IApi } from '../../types';
import { build } from './builder/builder';
import { absServerBuildPath } from './utils';

export default (api: IApi) => {
@@ -60,6 +59,9 @@ export { React };
});

api.onBeforeCompiler(async () => {
const { build }: typeof import('./builder/builder') = importLazy(
require.resolve('./builder/builder'),
);
await build({
api,
watch: api.env === 'development',

0 comments on commit 8a5a062

Please sign in to comment.