Skip to content
This repository has been archived by the owner on Nov 17, 2022. It is now read-only.

CSR 渲染 Document 报错 #427

Closed
luhc228 opened this issue Aug 10, 2022 · 0 comments
Closed

CSR 渲染 Document 报错 #427

luhc228 opened this issue Aug 10, 2022 · 0 comments
Assignees
Labels
bug Something isn't working urgent

Comments

@luhc228
Copy link
Member

luhc228 commented Aug 10, 2022

在开启 CSR 时,会先把匹配的路由组件都加载进来,对于一些立即执行语句和 import 了非标准的 npm 包时可能会报错,导致 Document 渲染也就报错。

临时解决方案:

- const routeModules = await loadRouteModules(matches.map(({ route: { id, load } }) => ({ id, load })));
  if (documentOnly) {
-  return renderDocument({ matches, routePath, renderOptions, routeModules });
+  return renderDocument({ matches, routePath, renderOptions, routeModules: {} });
  }
  // 存在的问题是 getConfig 失效了
  + const routeModules = await loadRouteModules(matches.map(({ route: { id, load } }) => ({ id, load })));
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working urgent
Projects
None yet
Development

No branches or pull requests

3 participants