@tramvai/cli 5.47.0 → 5.48.0
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.
- package/lib/library/webpack/loaders/root-error-boundary-loader/index.js +3 -3
- package/lib/library/webpack/loaders/root-error-boundary-loader/index.js.map +1 -1
- package/lib/utils/shouldUseReactRoot.js +2 -2
- package/lib/utils/shouldUseReactRoot.js.map +1 -1
- package/package.json +4 -4
- package/src/api/benchmark/__integration__/__fixtures__/app/index.tsx +2 -2
- package/src/api/build/__integration__/__fixtures__/app/index.tsx +3 -4
- package/src/api/start/__integration__/__fixtures__/app/index.tsx +2 -2
- package/src/api/start/__integration__/start.test.ts +0 -1
- package/src/library/swc/__integration__/__snapshots__/swc.build.test.ts.snap +32 -16
- package/src/library/webpack/loaders/root-error-boundary-loader/index.ts +3 -3
- package/src/utils/shouldUseReactRoot.ts +2 -2
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const shouldUseReactRoot_1 = require("../../../../utils/shouldUseReactRoot");
|
|
4
4
|
const COMPONENT_NAME = 'RootErrorBoundary';
|
|
5
|
-
const
|
|
5
|
+
const REACT_HYDRATE_ROOT_CODE = `
|
|
6
6
|
const { hydrateRoot } = require('react-dom/client')
|
|
7
7
|
|
|
8
8
|
hydrateRoot(
|
|
@@ -10,7 +10,7 @@ hydrateRoot(
|
|
|
10
10
|
<${COMPONENT_NAME} error={window.serverError} url={window.serverUrl} />,
|
|
11
11
|
);
|
|
12
12
|
`;
|
|
13
|
-
const
|
|
13
|
+
const REACT_HYDRATE_CODE = `
|
|
14
14
|
const { hydrate } = require('react-dom')
|
|
15
15
|
|
|
16
16
|
hydrate(
|
|
@@ -25,7 +25,7 @@ const rootErrorBoundaryLoader = function (content) {
|
|
|
25
25
|
// We don't need hydration code on the server
|
|
26
26
|
if (options.buildType === 'client') {
|
|
27
27
|
const IMPORT_CODE = `import ${COMPONENT_NAME} from "${options.path}"\n`;
|
|
28
|
-
const HYDRATION_CODE = (0, shouldUseReactRoot_1.shouldUseReactRoot)() ?
|
|
28
|
+
const HYDRATION_CODE = (0, shouldUseReactRoot_1.shouldUseReactRoot)() ? REACT_HYDRATE_ROOT_CODE : REACT_HYDRATE_CODE;
|
|
29
29
|
return IMPORT_CODE.concat(HYDRATION_CODE);
|
|
30
30
|
}
|
|
31
31
|
return content;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/library/webpack/loaders/root-error-boundary-loader/index.ts"],"names":[],"mappings":";;AAGA,6EAA0E;AAO1E,MAAM,cAAc,GAAG,mBAAmB,CAAC;AAC3C,MAAM,uBAAuB,GAAG;;;;;KAK3B,cAAc;;CAElB,CAAC;AACF,MAAM,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/library/webpack/loaders/root-error-boundary-loader/index.ts"],"names":[],"mappings":";;AAGA,6EAA0E;AAO1E,MAAM,cAAc,GAAG,mBAAmB,CAAC;AAC3C,MAAM,uBAAuB,GAAG;;;;;KAK3B,cAAc;;CAElB,CAAC;AACF,MAAM,kBAAkB,GAAG;;;;KAItB,cAAc;;;CAGlB,CAAC;AAEF,sCAAsC;AACtC,MAAM,uBAAuB,GAA8B,UAAU,OAAO;IAC1E,MAAM,OAAO,GAAG,IAAI,CAAC,UAAU,EAAE,CAAC;IAElC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;IAEtB,6CAA6C;IAC7C,IAAI,OAAO,CAAC,SAAS,KAAK,QAAQ,EAAE;QAClC,MAAM,WAAW,GAAG,UAAU,cAAc,UAAU,OAAO,CAAC,IAAI,KAAK,CAAC;QACxE,MAAM,cAAc,GAAG,IAAA,uCAAkB,GAAE,CAAC,CAAC,CAAC,uBAAuB,CAAC,CAAC,CAAC,kBAAkB,CAAC;QAE3F,OAAO,WAAW,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC;KAC3C;IAED,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC;AAEF,kBAAe,uBAAuB,CAAC"}
|
|
@@ -9,8 +9,8 @@ exports.shouldUseReactRoot = (0, once_1.default)(() => {
|
|
|
9
9
|
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
10
10
|
const reactVersion = require('react').version;
|
|
11
11
|
const isReactExperimental = reactVersion && /0\.0\.0-experimental/.test(reactVersion);
|
|
12
|
-
const
|
|
12
|
+
const hasReact18orHigher = reactVersion &&
|
|
13
13
|
(semver_1.default.gte(reactVersion, '18.0.0') || semver_1.default.coerce(reactVersion)?.version === '18.0.0');
|
|
14
|
-
return Boolean(
|
|
14
|
+
return Boolean(hasReact18orHigher || isReactExperimental);
|
|
15
15
|
});
|
|
16
16
|
//# sourceMappingURL=shouldUseReactRoot.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shouldUseReactRoot.js","sourceRoot":"","sources":["../../src/utils/shouldUseReactRoot.ts"],"names":[],"mappings":";;;;AAAA,gFAAgD;AAChD,4DAA4B;AAE5B,8FAA8F;AACjF,QAAA,kBAAkB,GAAG,IAAA,cAAI,EAAC,GAAG,EAAE;IAC1C,6DAA6D;IAC7D,MAAM,YAAY,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC;IAC9C,MAAM,mBAAmB,GAAG,YAAY,IAAI,sBAAsB,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;IACtF,MAAM,
|
|
1
|
+
{"version":3,"file":"shouldUseReactRoot.js","sourceRoot":"","sources":["../../src/utils/shouldUseReactRoot.ts"],"names":[],"mappings":";;;;AAAA,gFAAgD;AAChD,4DAA4B;AAE5B,8FAA8F;AACjF,QAAA,kBAAkB,GAAG,IAAA,cAAI,EAAC,GAAG,EAAE;IAC1C,6DAA6D;IAC7D,MAAM,YAAY,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC;IAC9C,MAAM,mBAAmB,GAAG,YAAY,IAAI,sBAAsB,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;IACtF,MAAM,kBAAkB,GACtB,YAAY;QACZ,CAAC,gBAAM,CAAC,GAAG,CAAC,YAAY,EAAE,QAAQ,CAAC,IAAI,gBAAM,CAAC,MAAM,CAAC,YAAY,CAAC,EAAE,OAAO,KAAK,QAAQ,CAAC,CAAC;IAE5F,OAAO,OAAO,CAAC,kBAAkB,IAAI,mBAAmB,CAAC,CAAC;AAC5D,CAAC,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tramvai/cli",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.48.0",
|
|
4
4
|
"description": "Cli инструмент для сборки и запуска приложений",
|
|
5
5
|
"files": [
|
|
6
6
|
"src",
|
|
@@ -75,7 +75,7 @@
|
|
|
75
75
|
"@tinkoff/utils": "^2.1.3",
|
|
76
76
|
"@tinkoff/webpack-dedupe-plugin": "4.0.3",
|
|
77
77
|
"@tramvai/build": "6.1.1",
|
|
78
|
-
"@tramvai/react": "5.
|
|
78
|
+
"@tramvai/react": "5.48.0",
|
|
79
79
|
"@tramvai/tools-check-versions": "0.7.7",
|
|
80
80
|
"@tramvai/tools-migrate": "0.9.8",
|
|
81
81
|
"ajv": "^8.12.0",
|
|
@@ -147,7 +147,7 @@
|
|
|
147
147
|
"process": "^0.11.10",
|
|
148
148
|
"promise-queue": "^2.2.5",
|
|
149
149
|
"proper-lockfile": "^4.1.2",
|
|
150
|
-
"react-refresh": "^0.
|
|
150
|
+
"react-refresh": "^0.16.0",
|
|
151
151
|
"resolve": "^1.22.4",
|
|
152
152
|
"rimraf": "^3.0.2",
|
|
153
153
|
"semver": "^7.3.7",
|
|
@@ -200,7 +200,7 @@
|
|
|
200
200
|
"@types/webpack-dev-middleware": "^5.0.2",
|
|
201
201
|
"@types/webpack-stats-plugin": "^0.3.2",
|
|
202
202
|
"babel-plugin-tester": "^10.1.0",
|
|
203
|
-
"react": "
|
|
203
|
+
"react": "19.0.0",
|
|
204
204
|
"sharp": "0.32.6"
|
|
205
205
|
},
|
|
206
206
|
"peerDependencies": {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import
|
|
2
|
+
import { hydrateRoot } from 'react-dom/client';
|
|
3
3
|
import App from './App';
|
|
4
4
|
|
|
5
5
|
const bundlesMap = {
|
|
@@ -17,4 +17,4 @@ if (url.searchParams.has('bundle')) {
|
|
|
17
17
|
);
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
hydrateRoot(document.getElementById('root')!, <App />);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { hydrateRoot } from 'react-dom/client';
|
|
2
2
|
import App from './App';
|
|
3
3
|
|
|
4
4
|
const bundlesMap = {
|
|
@@ -9,7 +9,7 @@ const bundlesMap = {
|
|
|
9
9
|
};
|
|
10
10
|
|
|
11
11
|
if (typeof window === 'undefined') {
|
|
12
|
-
require('./server.tsx')
|
|
12
|
+
require('./server.tsx');
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
if (typeof window !== 'undefined') {
|
|
@@ -21,6 +21,5 @@ if (typeof window !== 'undefined') {
|
|
|
21
21
|
);
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
hydrateRoot(document.getElementById('root')!, <App />);
|
|
26
25
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import ReactDOM from 'react-dom';
|
|
2
1
|
import App from './App';
|
|
2
|
+
import { hydrateRoot } from 'react-dom/client';
|
|
3
3
|
|
|
4
4
|
const bundlesMap = {
|
|
5
5
|
main: () => import('./bundles/main'),
|
|
@@ -19,5 +19,5 @@ if (typeof window === 'undefined') {
|
|
|
19
19
|
]().then(({ default: name }: { default: string }) => console.log(`loaded bundle ${name}`));
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
hydrateRoot(document.getElementById('root')!, <App />);
|
|
23
23
|
}
|
|
@@ -133,7 +133,6 @@ describe('@tramvai/cli start command', () => {
|
|
|
133
133
|
).toMatchInlineSnapshot(`"Cmp test: start"`);
|
|
134
134
|
|
|
135
135
|
await outputFile(REFRESH_CMP_PATH, CMP_FILE_CONTENT_UPDATE);
|
|
136
|
-
|
|
137
136
|
await page.waitForFunction(
|
|
138
137
|
() => {
|
|
139
138
|
return document.getElementById('cmp')?.innerHTML !== 'Cmp test: start';
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
3
|
exports[`client-legacy: create-token-pure.ts 1`] = `
|
|
4
|
-
"
|
|
4
|
+
" "use strict";
|
|
5
|
+
__webpack_require__.r(__webpack_exports__),
|
|
5
6
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
6
7
|
/* harmony export */ TEST_TOKEN: function() {
|
|
7
8
|
/* binding */ return TEST_TOKEN;
|
|
@@ -13,7 +14,8 @@ exports[`client-legacy: create-token-pure.ts 1`] = `
|
|
|
13
14
|
`;
|
|
14
15
|
|
|
15
16
|
exports[`client-legacy: images/logo.svg\\?react 1`] = `
|
|
16
|
-
"
|
|
17
|
+
" "use strict";
|
|
18
|
+
/* harmony import */ var _swc_helpers_object_spread__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__("../../node_modules/@swc/helpers/esm/_object_spread.js"), _swc_helpers_object_spread_props__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("../../node_modules/@swc/helpers/esm/_object_spread_props.js"), react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("webpack/sharing/consume/default/react/jsx-runtime/react/jsx-runtime");
|
|
17
19
|
/* harmony import */ __webpack_require__("webpack/sharing/consume/default/react/react"),
|
|
18
20
|
/* harmony default export */ __webpack_exports__.Z = function(props) {
|
|
19
21
|
/*#__PURE__*/
|
|
@@ -56,7 +58,8 @@ exports[`client-legacy: images/logo.svg\\?react 1`] = `
|
|
|
56
58
|
`;
|
|
57
59
|
|
|
58
60
|
exports[`client-legacy: lazy-component.tsx 1`] = `
|
|
59
|
-
"
|
|
61
|
+
" "use strict";
|
|
62
|
+
__webpack_require__.r(__webpack_exports__),
|
|
60
63
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
61
64
|
/* harmony export */ Component: function() {
|
|
62
65
|
/* binding */ return Component;
|
|
@@ -101,7 +104,8 @@ exports[`client-legacy: lazy-component.tsx 1`] = `
|
|
|
101
104
|
`;
|
|
102
105
|
|
|
103
106
|
exports[`client-legacy: node-env.ts 1`] = `
|
|
104
|
-
"
|
|
107
|
+
" "use strict";
|
|
108
|
+
__webpack_require__.r(__webpack_exports__),
|
|
105
109
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
106
110
|
/* harmony export */ func: function() {
|
|
107
111
|
/* binding */ return func;
|
|
@@ -114,7 +118,8 @@ exports[`client-legacy: node-env.ts 1`] = `
|
|
|
114
118
|
`;
|
|
115
119
|
|
|
116
120
|
exports[`client-legacy: provider-stack.ts 1`] = `
|
|
117
|
-
"
|
|
121
|
+
" "use strict";
|
|
122
|
+
__webpack_require__.r(__webpack_exports__),
|
|
118
123
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
119
124
|
/* harmony export */ providers: function() {
|
|
120
125
|
/* binding */ return providers;
|
|
@@ -130,7 +135,8 @@ exports[`client-legacy: provider-stack.ts 1`] = `
|
|
|
130
135
|
`;
|
|
131
136
|
|
|
132
137
|
exports[`client-legacy: react-svg.tsx 1`] = `
|
|
133
|
-
"
|
|
138
|
+
" "use strict";
|
|
139
|
+
__webpack_require__.r(__webpack_exports__),
|
|
134
140
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
135
141
|
/* harmony export */ Component: function() {
|
|
136
142
|
/* binding */ return Component;
|
|
@@ -147,7 +153,8 @@ exports[`client-legacy: react-svg.tsx 1`] = `
|
|
|
147
153
|
`;
|
|
148
154
|
|
|
149
155
|
exports[`client-legacy: server.inline.ts 1`] = `
|
|
150
|
-
"
|
|
156
|
+
" "use strict";
|
|
157
|
+
__webpack_require__.r(__webpack_exports__),
|
|
151
158
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
152
159
|
/* harmony export */ ForBrowser: function() {
|
|
153
160
|
/* binding */ return ForBrowser;
|
|
@@ -173,7 +180,8 @@ exports[`client-legacy: server.inline.ts 1`] = `
|
|
|
173
180
|
`;
|
|
174
181
|
|
|
175
182
|
exports[`client-legacy: typeof-window.ts 1`] = `
|
|
176
|
-
"
|
|
183
|
+
" "use strict";
|
|
184
|
+
__webpack_require__.r(__webpack_exports__),
|
|
177
185
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
178
186
|
/* harmony export */ func: function() {
|
|
179
187
|
/* binding */ return func;
|
|
@@ -186,7 +194,8 @@ exports[`client-legacy: typeof-window.ts 1`] = `
|
|
|
186
194
|
`;
|
|
187
195
|
|
|
188
196
|
exports[`client-modern: create-token-pure.ts 1`] = `
|
|
189
|
-
"
|
|
197
|
+
" "use strict";
|
|
198
|
+
__webpack_require__.r(__webpack_exports__),
|
|
190
199
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
191
200
|
/* harmony export */ TEST_TOKEN: function() {
|
|
192
201
|
/* binding */ return TEST_TOKEN;
|
|
@@ -197,7 +206,8 @@ exports[`client-modern: create-token-pure.ts 1`] = `
|
|
|
197
206
|
`;
|
|
198
207
|
|
|
199
208
|
exports[`client-modern: images/logo.svg\\?react 1`] = `
|
|
200
|
-
"
|
|
209
|
+
" "use strict";
|
|
210
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
201
211
|
/* harmony export */ Z: function() {
|
|
202
212
|
return __WEBPACK_DEFAULT_EXPORT__;
|
|
203
213
|
}
|
|
@@ -242,7 +252,8 @@ exports[`client-modern: images/logo.svg\\?react 1`] = `
|
|
|
242
252
|
`;
|
|
243
253
|
|
|
244
254
|
exports[`client-modern: lazy-component.tsx 1`] = `
|
|
245
|
-
"
|
|
255
|
+
" "use strict";
|
|
256
|
+
__webpack_require__.r(__webpack_exports__),
|
|
246
257
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
247
258
|
/* harmony export */ Component: function() {
|
|
248
259
|
/* binding */ return Component;
|
|
@@ -275,7 +286,8 @@ exports[`client-modern: lazy-component.tsx 1`] = `
|
|
|
275
286
|
`;
|
|
276
287
|
|
|
277
288
|
exports[`client-modern: node-env.ts 1`] = `
|
|
278
|
-
"
|
|
289
|
+
" "use strict";
|
|
290
|
+
let internalFunc;
|
|
279
291
|
__webpack_require__.r(__webpack_exports__),
|
|
280
292
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
281
293
|
/* harmony export */ func: function() {
|
|
@@ -287,7 +299,8 @@ exports[`client-modern: node-env.ts 1`] = `
|
|
|
287
299
|
`;
|
|
288
300
|
|
|
289
301
|
exports[`client-modern: provider-stack.ts 1`] = `
|
|
290
|
-
"
|
|
302
|
+
" "use strict";
|
|
303
|
+
__webpack_require__.r(__webpack_exports__),
|
|
291
304
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
292
305
|
/* harmony export */ providers: function() {
|
|
293
306
|
/* binding */ return providers;
|
|
@@ -302,7 +315,8 @@ exports[`client-modern: provider-stack.ts 1`] = `
|
|
|
302
315
|
`;
|
|
303
316
|
|
|
304
317
|
exports[`client-modern: react-svg.tsx 1`] = `
|
|
305
|
-
"
|
|
318
|
+
" "use strict";
|
|
319
|
+
__webpack_require__.r(__webpack_exports__),
|
|
306
320
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
307
321
|
/* harmony export */ Component: function() {
|
|
308
322
|
/* binding */ return Component;
|
|
@@ -316,7 +330,8 @@ exports[`client-modern: react-svg.tsx 1`] = `
|
|
|
316
330
|
`;
|
|
317
331
|
|
|
318
332
|
exports[`client-modern: server.inline.ts 1`] = `
|
|
319
|
-
"
|
|
333
|
+
" "use strict";
|
|
334
|
+
__webpack_require__.r(__webpack_exports__),
|
|
320
335
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
321
336
|
/* harmony export */ ForBrowser: function() {
|
|
322
337
|
/* binding */ return ForBrowser;
|
|
@@ -339,7 +354,8 @@ exports[`client-modern: server.inline.ts 1`] = `
|
|
|
339
354
|
`;
|
|
340
355
|
|
|
341
356
|
exports[`client-modern: typeof-window.ts 1`] = `
|
|
342
|
-
"
|
|
357
|
+
" "use strict";
|
|
358
|
+
let internalFunc;
|
|
343
359
|
__webpack_require__.r(__webpack_exports__),
|
|
344
360
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
345
361
|
/* harmony export */ func: function() {
|
|
@@ -9,7 +9,7 @@ interface Options {
|
|
|
9
9
|
path: string;
|
|
10
10
|
}
|
|
11
11
|
const COMPONENT_NAME = 'RootErrorBoundary';
|
|
12
|
-
const
|
|
12
|
+
const REACT_HYDRATE_ROOT_CODE = `
|
|
13
13
|
const { hydrateRoot } = require('react-dom/client')
|
|
14
14
|
|
|
15
15
|
hydrateRoot(
|
|
@@ -17,7 +17,7 @@ hydrateRoot(
|
|
|
17
17
|
<${COMPONENT_NAME} error={window.serverError} url={window.serverUrl} />,
|
|
18
18
|
);
|
|
19
19
|
`;
|
|
20
|
-
const
|
|
20
|
+
const REACT_HYDRATE_CODE = `
|
|
21
21
|
const { hydrate } = require('react-dom')
|
|
22
22
|
|
|
23
23
|
hydrate(
|
|
@@ -35,7 +35,7 @@ const rootErrorBoundaryLoader: LoaderDefinition<Options> = function (content) {
|
|
|
35
35
|
// We don't need hydration code on the server
|
|
36
36
|
if (options.buildType === 'client') {
|
|
37
37
|
const IMPORT_CODE = `import ${COMPONENT_NAME} from "${options.path}"\n`;
|
|
38
|
-
const HYDRATION_CODE = shouldUseReactRoot() ?
|
|
38
|
+
const HYDRATION_CODE = shouldUseReactRoot() ? REACT_HYDRATE_ROOT_CODE : REACT_HYDRATE_CODE;
|
|
39
39
|
|
|
40
40
|
return IMPORT_CODE.concat(HYDRATION_CODE);
|
|
41
41
|
}
|
|
@@ -6,9 +6,9 @@ export const shouldUseReactRoot = once(() => {
|
|
|
6
6
|
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
7
7
|
const reactVersion = require('react').version;
|
|
8
8
|
const isReactExperimental = reactVersion && /0\.0\.0-experimental/.test(reactVersion);
|
|
9
|
-
const
|
|
9
|
+
const hasReact18orHigher =
|
|
10
10
|
reactVersion &&
|
|
11
11
|
(semver.gte(reactVersion, '18.0.0') || semver.coerce(reactVersion)?.version === '18.0.0');
|
|
12
12
|
|
|
13
|
-
return Boolean(
|
|
13
|
+
return Boolean(hasReact18orHigher || isReactExperimental);
|
|
14
14
|
});
|