From 9b29b8e2eb2cf8380a21a050f1fdd7083aedaa3f Mon Sep 17 00:00:00 2001 From: harrywan Date: Fri, 23 Oct 2020 11:23:14 +0800 Subject: [PATCH] =?UTF-8?q?fix(fes-cli):=20=E4=BF=AE=E5=A4=8Dwindow?= =?UTF-8?q?=E4=B8=8B=E7=BC=96=E8=AF=91=E8=B7=AF=E7=94=B1=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E6=97=B6=E8=B7=AF=E5=BE=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/fes-cli/build/preComplie/route.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/fes-cli/build/preComplie/route.js b/packages/fes-cli/build/preComplie/route.js index a4e2460b..90383832 100644 --- a/packages/fes-cli/build/preComplie/route.js +++ b/packages/fes-cli/build/preComplie/route.js @@ -18,14 +18,14 @@ const isProcessFile = function (path) { }; const isProcessDirectory = function (path, item) { - const component = Path.posix.join(path, item); + const component = Path.join(path, item); return fs.statSync(component).isDirectory() && !['components'].includes(item); }; const checkHasLayout = function (path) { const dirList = fs.readdirSync(path); return dirList.some((item) => { - if (!isProcessFile(Path.posix.join(path, item))) { + if (!isProcessFile(Path.join(path, item))) { return false; } const ext = Path.extname(item); @@ -66,7 +66,7 @@ const build = function (components, parentRoutes, path, parentRoutePath) { } dirList.forEach((item) => { // 文件或者目录的绝对路径 - const component = Path.posix.join(path, item); + const component = Path.join(path, item); if (isProcessFile(component)) { const ext = Path.extname(item); const fileName = Path.basename(item, ext); @@ -76,7 +76,7 @@ const build = function (components, parentRoutes, path, parentRoutePath) { const routeName = getRouteName(parentRoutePath, fileName); components.push({ name: routeName, - path: component + path: component.replace(/\\/g, '\\\\') // 处理windows兼容性 }); if (hasLayout) { if (fileName === 'layout') { @@ -101,7 +101,7 @@ const build = function (components, parentRoutes, path, parentRoutePath) { dirList.forEach((item) => { if (isProcessDirectory(path, item)) { // 文件或者目录的绝对路径 - const component = Path.posix.join(path, item); + const component = Path.join(path, item); const nextParentRouteUrl = Path.posix.join(parentRoutePath, item); if (hasLayout) { build(components, layoutRoute.children, component, nextParentRouteUrl);