编译routerr时,namespaces下的index.json的path不一定配置,这里判断下

This commit is contained in:
wkj 2023-12-24 18:08:09 +08:00
parent 2b43b36c26
commit 4e11d40e3c
4 changed files with 20 additions and 8 deletions

View File

@ -101,9 +101,15 @@ function makeWebAllRouters(namespaceDir, projectDir, routerFileDir) {
let notFound2 = '', first2 = '';
if ((0, fs_extra_1.existsSync)(nsIndexJsonFile)) {
const { path, notFound, first } = require(nsIndexJsonFile);
path2 = path.replace(/\\/g, '/');
notFound2 = notFound.replace(/\\/g, '/');
first2 = first.replace(/\\/g, '/');
if (path) {
path2 = path.replace(/\\/g, '/');
}
if (notFound) {
notFound2 = notFound.replace(/\\/g, '/');
}
if (first) {
first2 = first.replace(/\\/g, '/');
}
}
const children = Object.values(pages).filter((ele) => ele.hasWeb).map(({ path, oakDisablePulldownRefresh }) => {
const properties = [

View File

@ -65,7 +65,7 @@ class SimpleConnector {
}
catch (err) {
// fetch返回异常一定是网络异常
throw new types_1.OakNetworkException();
throw new types_1.OakNetworkException(`请求[${this.serverAspectUrl}],发生网络异常`);
}
if (response.status > 299) {
const err = new types_1.OakServerProxyException(`网络请求返回status是${response.status}`);

View File

@ -162,9 +162,15 @@ function makeWebAllRouters(namespaceDir: string, projectDir: string, routerFileD
let notFound2 = '', first2 = '';
if (existsSync(nsIndexJsonFile)) {
const { path, notFound, first } = require(nsIndexJsonFile);
path2 = path.replace(/\\/g, '/');
notFound2 = notFound.replace(/\\/g, '/');
first2 = first.replace(/\\/g, '/');
if (path) {
path2 = path.replace(/\\/g, '/');
}
if (notFound) {
notFound2 = notFound.replace(/\\/g, '/');
}
if (first) {
first2 = first.replace(/\\/g, '/');
}
}
const children = Object.values(pages).filter(
(ele) => ele.hasWeb

View File

@ -83,7 +83,7 @@ export class SimpleConnector<ED extends EntityDict, FrontCxt extends SyncContext
});
} catch (err) {
// fetch返回异常一定是网络异常
throw new OakNetworkException();
throw new OakNetworkException(`请求[${this.serverAspectUrl}],发生网络异常`);
}
if (response.status > 299) {
const err = new OakServerProxyException(