mirror of https://github.com/alibaba/ice.git
fix: can not get the getStaticPaths method (#5325)
This commit is contained in:
parent
789e3f8acc
commit
f7512ce022
|
|
@ -1,7 +1,9 @@
|
|||
import { lazy } from 'ice';
|
||||
import Home from '@/pages/Home';
|
||||
import About from '@/pages/About';
|
||||
import Dashboard from '@/pages/Dashboard';
|
||||
import NotFound from '@/pages/NotFound';
|
||||
import Dashboard from '@/pages/Dashboard';
|
||||
|
||||
const About = lazy(() => import('@/pages/About'));
|
||||
|
||||
export default [
|
||||
{
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@
|
|||
"build-plugin-ice-mpa": "2.1.1",
|
||||
"build-plugin-ice-request": "2.0.0",
|
||||
"build-plugin-ice-router": "2.1.3",
|
||||
"build-plugin-ice-ssr": "3.1.2",
|
||||
"build-plugin-ice-ssr": "3.1.3",
|
||||
"build-plugin-ice-store": "2.0.7",
|
||||
"build-plugin-react-app": "2.2.2",
|
||||
"build-plugin-pwa": "1.1.1",
|
||||
|
|
|
|||
|
|
@ -1,5 +1,9 @@
|
|||
# Changelog
|
||||
|
||||
## 3.1.3
|
||||
|
||||
- [fix] can't get the getStaticPaths method from the dynamic import route component
|
||||
|
||||
## 3.1.2
|
||||
|
||||
- [feat] support generate defaultLocale HTML in SSG
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "build-plugin-ice-ssr",
|
||||
"version": "3.1.2",
|
||||
"version": "3.1.3",
|
||||
"description": "ssr plugin",
|
||||
"author": "ice-admin@alibaba-inc.com",
|
||||
"homepage": "",
|
||||
|
|
|
|||
|
|
@ -73,7 +73,13 @@ async function getFlatRoutes(routes, parentPath = '') {
|
|||
route.component = loadable(route.component.dynamicImport);
|
||||
}
|
||||
prev.push(route);
|
||||
const getStaticPaths = route.getStaticPaths || route.component.getStaticPaths;
|
||||
// normal import component
|
||||
let getStaticPaths = route.getStaticPaths || route.component.getStaticPaths;
|
||||
if (route.component.load) {
|
||||
// dynamic import component
|
||||
const loadedPageComponent = await route.component.load();
|
||||
getStaticPaths = (loadedPageComponent.default || loadedPageComponent).getStaticPaths;
|
||||
}
|
||||
if (typeof getStaticPaths === 'function') {
|
||||
const staticPaths = await getStaticPaths();
|
||||
if (Array.isArray(staticPaths)) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue