|
8 | 8 | ConcurrentRoot,
|
9 | 9 | } from 'react-reconciler/constants.js'
|
10 | 10 |
|
11 |
| -// @ts-ignore |
12 |
| -const __DEV__ = /* @__PURE__ */ (() => typeof process !== 'undefined' && process.env.NODE_ENV !== 'production')() |
13 |
| - |
14 | 11 | // TODO: upstream to DefinitelyTyped for React 19
|
15 | 12 | // https://github.com/facebook/react/issues/28956
|
16 | 13 | type EventPriority = number
|
@@ -112,7 +109,7 @@ function createReconciler<
|
112 | 109 | const reconciler = Reconciler(config as any)
|
113 | 110 |
|
114 | 111 | reconciler.injectIntoDevTools({
|
115 |
| - bundleType: __DEV__ ? 1 : 0, |
| 112 | + bundleType: typeof process !== 'undefined' && process.env.NODE_ENV !== 'production' ? 1 : 0, |
116 | 113 | rendererPackageName: 'react-nil',
|
117 | 114 | version: React.version,
|
118 | 115 | })
|
@@ -263,13 +260,13 @@ const reconciler = /* @__PURE__ */ createReconciler<
|
263 | 260 |
|
264 | 261 | // Report when an error was detected in a previous render
|
265 | 262 | // https://github.com/facebook/react/pull/23207
|
266 |
| -const logRecoverableError = /* @__PURE__ */ (() => |
267 |
| - typeof reportError === 'function' |
268 |
| - ? // In modern browsers, reportError will dispatch an error event, |
269 |
| - // emulating an uncaught JavaScript error. |
270 |
| - reportError |
271 |
| - : // In older browsers and test environments, fallback to console.error. |
272 |
| - console.error)() |
| 263 | +function logRecoverableError(error: any): void { |
| 264 | + // In modern browsers, reportError will dispatch an error event, |
| 265 | + // emulating an uncaught JavaScript error. |
| 266 | + if (typeof reportError === 'function') return reportError(error) |
| 267 | + // In older browsers and test environments, fallback to console.error. |
| 268 | + else return console.error(error) |
| 269 | +} |
273 | 270 |
|
274 | 271 | const container: HostContainer = { head: null }
|
275 | 272 | const root = /* @__PURE__ */ (reconciler as any).createContainer(
|
|
0 commit comments