@appigram/react-code-split-ssr 1.2.10 → 1.2.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -17,9 +17,12 @@ const generateRoutes = (options = {
17
17
  throw new Error("options.routes must be an non-empty array");
18
18
  }
19
19
  const preload = options.routes.find((route) => !!matchPath(route.path, options.pathname));
20
- const preloadedComp = preload === undefined
21
- ? yield options.notFoundComp().props.mod
22
- : yield preload.element().props.mod;
20
+ const preloadedElement = preload === undefined ? options.notFoundComp : preload.element;
21
+ // fallback to previous version
22
+ const preloadedComp = typeof preloadedElement === 'function' ?
23
+ yield preloadedElement().props.mod
24
+ :
25
+ yield preloadedElement.props.mod;
23
26
  const renderElement = (path, bundle) => {
24
27
  if (!preloadedComp)
25
28
  return bundle;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@appigram/react-code-split-ssr",
3
- "version": "1.2.10",
3
+ "version": "1.2.12",
4
4
  "description": "React code splitting with SSR",
5
5
  "main": "./lib/index.js",
6
6
  "scripts": {
@@ -22,15 +22,15 @@
22
22
  "author": "Eugene Sysmanov",
23
23
  "license": "MIT",
24
24
  "devDependencies": {
25
- "@types/react": "^18.0.28",
25
+ "@types/react": "^18.2.33",
26
26
  "@types/react-router-dom": "^5.3.3",
27
27
  "tslint": "^6.1.3",
28
28
  "tslint-react": "^5.0.0",
29
- "typescript": "^4.9.5"
29
+ "typescript": "^5.2.2"
30
30
  },
31
31
  "dependencies": {
32
32
  "react": "^18.2.0",
33
33
  "react-dom": "^18.2.0",
34
- "react-router-dom": "^6.8.2"
34
+ "react-router-dom": "^6.17.0"
35
35
  }
36
36
  }
@@ -33,10 +33,13 @@ const generateRoutes = async (
33
33
  (route) => !!matchPath(route.path, options.pathname)
34
34
  );
35
35
 
36
- const preloadedComp: any =
37
- preload === undefined
38
- ? await options.notFoundComp().props.mod
39
- : await preload.element().props.mod;
36
+ const preloadedElement = preload === undefined ? options.notFoundComp : preload.element
37
+
38
+ // fallback to previous version
39
+ const preloadedComp: any = typeof preloadedElement === 'function' ?
40
+ await preloadedElement().props.mod
41
+ :
42
+ await preloadedElement.props.mod
40
43
 
41
44
  const renderElement = (path: string, bundle: ReactElement) => {
42
45
  if (!preloadedComp) return bundle;