diff --git a/packages/preset-umi/src/features/ssr/ssr.ts b/packages/preset-umi/src/features/ssr/ssr.ts index 4d18a42da49b..22d0da952d32 100644 --- a/packages/preset-umi/src/features/ssr/ssr.ts +++ b/packages/preset-umi/src/features/ssr/ssr.ts @@ -103,6 +103,10 @@ export default (api: IApi) => { api.addMiddlewares(() => [ async (req, res, next) => { + if (serverBuildTarget === 'worker') { + return next(); + } + const modulePath = absServerBuildPath(api); if (existsSync(modulePath)) { delete require.cache[modulePath];