Skip to content

Commit 5c97ec2

Browse files
authored
chore: getServerManifest should run first on prepare (#6638)
1 parent eab6089 commit 5c97ec2

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

Diff for: .changeset/tasty-ears-bake.md

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
'@modern-js/server-core': patch
3+
---
4+
5+
chore: `getServerManifest` should run first on `prepare`
6+
chore: `getServerManifest` 应该在 `prepare` 时运行

Diff for: packages/server/core/src/adapters/node/plugins/resource.ts

+6
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import {
99
ROUTE_MANIFEST_FILE,
1010
SERVER_BUNDLE_DIRECTORY,
1111
compatibleRequire,
12+
isProd,
1213
} from '@modern-js/utils';
1314
import type {
1415
Middleware,
@@ -148,6 +149,11 @@ export const injectResourcePlugin = (): ServerPlugin => ({
148149
async prepare() {
149150
const { middlewares, routes, distDirectory: pwd } = api.useAppContext();
150151

152+
// In Production, should warmup server bundles on prepare.
153+
if (isProd()) {
154+
getServerManifest(pwd, routes || [], console);
155+
}
156+
151157
middlewares.push({
152158
name: 'inject-server-manifest',
153159

0 commit comments

Comments
 (0)