Skip to content

Commit

Permalink
fix: add layout file when collect ssr loader
Browse files Browse the repository at this point in the history
  • Loading branch information
ppppp-x-x committed Sep 25, 2023
1 parent 4fa976e commit 4ad9bb2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,6 @@ exports[`getRoutes 1`] = `
"path": "/absolute",
},
"@@/global-layout": {
"__content": "",
"__isJSFile": true,
"absPath": "/",
"file": "@/layouts/index.tsx",
"id": "@@/global-layout",
Expand Down
7 changes: 5 additions & 2 deletions packages/preset-umi/src/features/tmpFiles/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,12 @@ export async function getRoutes(opts: {
}

const isJSFile = /.[jt]sx?$/.test(file);
routes[id].__content = readFileSync(file, 'utf-8');
// layout route 这里不需要这些属性
if (!routes[id].isLayout) {
routes[id].__content = readFileSync(file, 'utf-8');
routes[id].__isJSFile = isJSFile;
}
routes[id].__absFile = winPath(file);
routes[id].__isJSFile = isJSFile;

const enableSSR = opts.api.config.ssr;
const enableClientLoader = opts.api.config.clientLoader;
Expand Down

0 comments on commit 4ad9bb2

Please sign in to comment.