@umijs/renderer-react 4.0.0-rc.11 → 4.0.0-rc.14

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.
Files changed (2) hide show
  1. package/dist/browser.js +10 -3
  2. package/package.json +7 -6
package/dist/browser.js CHANGED
@@ -1,5 +1,6 @@
1
1
  import React from 'react';
2
- import ReactDOM from 'react-dom';
2
+ // compatible with < react@18 in @umijs/preset-umi/src/features/react
3
+ import ReactDOM from 'react-dom/client';
3
4
  import { Router, useRoutes } from 'react-router-dom';
4
5
  import { AppContext, useAppData } from './appContext';
5
6
  import { createClientRoutes } from './routes';
@@ -40,6 +41,13 @@ export function renderClient(opts) {
40
41
  routeComponents: opts.routeComponents,
41
42
  loadingComponent: opts.loadingComponent,
42
43
  });
44
+ opts.pluginManager.applyPlugins({
45
+ key: 'patchClientRoutes',
46
+ type: 'event',
47
+ args: {
48
+ routes: clientRoutes,
49
+ },
50
+ });
43
51
  let rootContainer = (React.createElement(BrowserRoutes, { basename: basename, pluginManager: opts.pluginManager, routes: opts.routes, clientRoutes: clientRoutes, history: opts.history },
44
52
  React.createElement(Routes, null)));
45
53
  for (const key of [
@@ -66,12 +74,11 @@ export function renderClient(opts) {
66
74
  rootElement: opts.rootElement,
67
75
  basename,
68
76
  } }, rootContainer));
69
- // @ts-ignore
70
77
  if (ReactDOM.createRoot) {
71
- // @ts-ignore
72
78
  ReactDOM.createRoot(rootElement).render(browser);
73
79
  }
74
80
  else {
81
+ // @ts-ignore
75
82
  ReactDOM.render(browser, rootElement);
76
83
  }
77
84
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umijs/renderer-react",
3
- "version": "4.0.0-rc.11",
3
+ "version": "4.0.0-rc.14",
4
4
  "description": "@umijs/renderer-react",
5
5
  "homepage": "https://github.com/umijs/umi-next/tree/master/packages/renderer-react#readme",
6
6
  "bugs": "https://github.com/umijs/umi-next/issues",
@@ -17,17 +17,18 @@
17
17
  ],
18
18
  "scripts": {
19
19
  "build": "pnpm tsc",
20
- "build:deps": "pnpm esno ../../scripts/bundleDeps.ts",
21
- "dev": "pnpm build -- --watch"
20
+ "build:deps": "umi-scripts bundleDeps",
21
+ "dev": "pnpm build -- --watch",
22
+ "test": "umi-scripts jest-turbo"
22
23
  },
23
24
  "dependencies": {
24
25
  "@loadable/component": "5.15.2",
25
26
  "history": "5.3.0",
26
- "react-router-dom": "6.2.2"
27
+ "react-router-dom": "6.3.0"
27
28
  },
28
29
  "devDependencies": {
29
- "react": "17.0.2",
30
- "react-dom": "17.0.2"
30
+ "react": "18.1.0",
31
+ "react-dom": "18.1.0"
31
32
  },
32
33
  "peerDependencies": {
33
34
  "react": ">=16.8",