zmp-react
Advanced tools
Comparing version 2.8.5 to 2.8.6
@@ -30,2 +30,16 @@ "use strict"; | ||
var loadAsyncRoute = function loadAsyncRoute(context, fileDir) { | ||
var resolve = context.resolve; | ||
if (!importPages || !importPages[fileDir]) { | ||
throw Error("Cannot find /" + fileDir); | ||
} | ||
importPages[fileDir]().then(function (res) { | ||
resolve({ | ||
component: res.default | ||
}); | ||
}); | ||
}; | ||
var initRoutes = function initRoutes(routes, isOldConfig) { | ||
@@ -44,8 +58,4 @@ var appRoutes; | ||
name: 'home', | ||
asyncComponent: function asyncComponent() { | ||
if (!importPages[fileDir]) { | ||
throw Error("Cannot find /" + fileDir); | ||
} | ||
return importPages[fileDir](); | ||
async: function async(context) { | ||
return loadAsyncRoute(context, fileDir); | ||
} | ||
@@ -63,8 +73,4 @@ }; | ||
path: routePath, | ||
asyncComponent: function asyncComponent() { | ||
if (!importPages[fileDir]) { | ||
throw Error("Cannot find /" + fileDir); | ||
} | ||
return importPages[fileDir](); | ||
async: function async(context) { | ||
return loadAsyncRoute(context, fileDir); | ||
} | ||
@@ -84,8 +90,4 @@ }; | ||
name: 'home', | ||
asyncComponent: function asyncComponent() { | ||
if (!importPages.index) { | ||
throw Error('Can not find Index Page'); | ||
} | ||
return importPages.index(); | ||
async: function async(context) { | ||
return loadAsyncRoute(context, 'index'); | ||
} | ||
@@ -118,5 +120,10 @@ }].concat(appRoutes); | ||
name: 'home', | ||
asyncComponent: function asyncComponent() { | ||
return Promise.resolve("/src/" + _constants.PAGE_DIR + "/" + pathToPage + fileName).then(function (s) { | ||
async: function async(_ref) { | ||
var resolve = _ref.resolve; | ||
Promise.resolve("/src/" + _constants.PAGE_DIR + "/" + pathToPage + fileName).then(function (s) { | ||
return _interopRequireWildcard(require(s)); | ||
}).then(function (res) { | ||
resolve({ | ||
component: res.default | ||
}); | ||
}); | ||
@@ -138,5 +145,10 @@ } | ||
path: routePath, | ||
asyncComponent: function asyncComponent() { | ||
return Promise.resolve("/src/" + _constants.PAGE_DIR + "/" + pathToPage + fileName).then(function (s) { | ||
async: function async(_ref2) { | ||
var resolve = _ref2.resolve; | ||
Promise.resolve("/src/" + _constants.PAGE_DIR + "/" + pathToPage + fileName).then(function (s) { | ||
return _interopRequireWildcard(require(s)); | ||
}).then(function (res) { | ||
resolve({ | ||
component: res.default | ||
}); | ||
}); | ||
@@ -157,5 +169,11 @@ } | ||
path: '/', | ||
asyncComponent: function asyncComponent() { | ||
return Promise.resolve("/src/" + _constants.PAGE_DIR + "/index").then(function (s) { | ||
name: 'home', | ||
async: function async(_ref3) { | ||
var resolve = _ref3.resolve; | ||
Promise.resolve("/src/" + _constants.PAGE_DIR + "/index").then(function (s) { | ||
return _interopRequireWildcard(require(s)); | ||
}).then(function (res) { | ||
resolve({ | ||
component: res.default | ||
}); | ||
}); | ||
@@ -162,0 +180,0 @@ } |
/** | ||
* ZMP React 2.8.5 | ||
* ZMP React 2.8.6 | ||
* Build full featured iOS & Android apps using ZMP & React | ||
@@ -10,3 +10,3 @@ * https://h5.zalo.me/react/ | ||
* | ||
* Released on: June 21, 2022 | ||
* Released on: June 22, 2022 | ||
*/ | ||
@@ -13,0 +13,0 @@ "use strict"; |
@@ -17,2 +17,16 @@ import { getWindow } from 'ssr-window'; | ||
var loadAsyncRoute = function loadAsyncRoute(context, fileDir) { | ||
var resolve = context.resolve; | ||
if (!importPages || !importPages[fileDir]) { | ||
throw Error("Cannot find /" + fileDir); | ||
} | ||
importPages[fileDir]().then(function (res) { | ||
resolve({ | ||
component: res.default | ||
}); | ||
}); | ||
}; | ||
var initRoutes = function initRoutes(routes, isOldConfig) { | ||
@@ -31,8 +45,4 @@ var appRoutes; | ||
name: 'home', | ||
asyncComponent: function asyncComponent() { | ||
if (!importPages[fileDir]) { | ||
throw Error("Cannot find /" + fileDir); | ||
} | ||
return importPages[fileDir](); | ||
async: function async(context) { | ||
return loadAsyncRoute(context, fileDir); | ||
} | ||
@@ -50,8 +60,4 @@ }; | ||
path: routePath, | ||
asyncComponent: function asyncComponent() { | ||
if (!importPages[fileDir]) { | ||
throw Error("Cannot find /" + fileDir); | ||
} | ||
return importPages[fileDir](); | ||
async: function async(context) { | ||
return loadAsyncRoute(context, fileDir); | ||
} | ||
@@ -71,8 +77,4 @@ }; | ||
name: 'home', | ||
asyncComponent: function asyncComponent() { | ||
if (!importPages.index) { | ||
throw Error('Can not find Index Page'); | ||
} | ||
return importPages.index(); | ||
async: function async(context) { | ||
return loadAsyncRoute(context, 'index'); | ||
} | ||
@@ -105,6 +107,11 @@ }].concat(appRoutes); | ||
name: 'home', | ||
asyncComponent: function asyncComponent() { | ||
return import( | ||
async: function async(_ref) { | ||
var resolve = _ref.resolve; | ||
import( | ||
/* @vite-ignore */ | ||
"/src/" + PAGE_DIR + "/" + pathToPage + fileName); | ||
"/src/" + PAGE_DIR + "/" + pathToPage + fileName).then(function (res) { | ||
resolve({ | ||
component: res.default | ||
}); | ||
}); | ||
} | ||
@@ -125,6 +132,11 @@ }; | ||
path: routePath, | ||
asyncComponent: function asyncComponent() { | ||
return import( | ||
async: function async(_ref2) { | ||
var resolve = _ref2.resolve; | ||
import( | ||
/* @vite-ignore */ | ||
"/src/" + PAGE_DIR + "/" + pathToPage + fileName); | ||
"/src/" + PAGE_DIR + "/" + pathToPage + fileName).then(function (res) { | ||
resolve({ | ||
component: res.default | ||
}); | ||
}); | ||
} | ||
@@ -144,6 +156,12 @@ }; | ||
path: '/', | ||
asyncComponent: function asyncComponent() { | ||
return import( | ||
name: 'home', | ||
async: function async(_ref3) { | ||
var resolve = _ref3.resolve; | ||
import( | ||
/* @vite-ignore */ | ||
"/src/" + PAGE_DIR + "/index"); | ||
"/src/" + PAGE_DIR + "/index").then(function (res) { | ||
resolve({ | ||
component: res.default | ||
}); | ||
}); | ||
} | ||
@@ -150,0 +168,0 @@ }].concat(routes); |
/** | ||
* ZMP React 2.8.5 | ||
* ZMP React 2.8.6 | ||
* Build full featured iOS & Android apps using ZMP & React | ||
@@ -10,3 +10,3 @@ * https://h5.zalo.me/react/ | ||
* | ||
* Released on: June 21, 2022 | ||
* Released on: June 22, 2022 | ||
*/ | ||
@@ -13,0 +13,0 @@ /* eslint-disable no-proto */ |
{ | ||
"name": "zmp-react", | ||
"version": "2.8.5", | ||
"version": "2.8.6", | ||
"description": "Build full featured iOS & Android apps using ZMP & React", | ||
@@ -5,0 +5,0 @@ "main": "cjs/zmp-react.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
1807827
40714