|
1 | 1 | 'use strict'; |
2 | 2 |
|
3 | 3 | // react-native-web exposes these style helpers only through internal modules. |
4 | | -// They're imported statically so strict-ESM bundlers (webpack, Rollup, esbuild) |
5 | | -// and SSR resolve them at build time and they're always defined synchronously - a |
6 | | -// runtime require() isn't available in ESM there, which left them undefined and |
7 | | -// crashed _updatePropsJS (#9844). The dist/cjs build (with explicit .js extensions) |
8 | | -// is used because SSR frameworks load an externalized react-native-web with Node's |
9 | | -// ESM resolver, which rejects the extensionless relative imports in dist/exports. |
| 4 | +// The dist/cjs build (with .js extensions) resolves under Metro, strict-ESM |
| 5 | +// bundlers and Node's ESM resolver (SSR); a runtime require() would not (#9844). |
10 | 6 | // eslint-disable-next-line n/no-unpublished-import |
11 | 7 | import * as createReactDOMStyleModule from 'react-native-web/dist/cjs/exports/StyleSheet/compiler/createReactDOMStyle.js'; |
12 | 8 | // eslint-disable-next-line n/no-unpublished-import |
13 | 9 | import * as preprocessModule from 'react-native-web/dist/cjs/exports/StyleSheet/preprocess.js'; |
14 | 10 |
|
15 | | -// createReactDOMStyle is a CJS default export (module.exports = fn), so unwrap |
16 | | -// `.default`. createTransformValue / createTextShadowValue are named exports on |
17 | | -// module.exports and are read directly - they're not on `.default`, which is a |
18 | | -// separate `preprocess` function. |
| 11 | +// createReactDOMStyle is `module.exports = fn` (unwrap `.default`); the preprocess |
| 12 | +// helpers are named exports read directly (not on `.default`, a separate fn). |
19 | 13 | // eslint-disable-next-line @typescript-eslint/no-explicit-any |
20 | 14 | const interopDefault = (moduleExports: any) => |
21 | 15 | moduleExports?.default ?? moduleExports; |
|
0 commit comments