Skip to content

Commit 6da53c5

Browse files
committed
not Windows fix
1 parent e0a4a9a commit 6da53c5

File tree

1 file changed

+8
-13
lines changed

1 file changed

+8
-13
lines changed

scripts/configure-projects.js

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -26,25 +26,16 @@ const {
2626
*
2727
* @note A naive search on disk might yield false positives so we also try to
2828
* use the stack trace to find it. This currently works in Node (V8) and Bun
29-
* (JSC), but not on Windows for some reason. On Windows, this causes 'xpath' to
30-
* crash:
29+
* (JSC).
3130
*
32-
* [xmldom error] invalid doc source
33-
* #[line:0,col:undefined]
34-
*
35-
* D:\~\node_modules\xpath\xpath.js:1787
36-
* if (firstNode.nodeType === 9) {
37-
* ^
38-
* TypeError: Cannot read properties of undefined (reading 'nodeType')
39-
*
40-
* @returns {string}
31+
* @returns {string} Path to `react-native.config.[ts,mjs,cjs,js]`
4132
*/
4233
function findReactNativeConfig(fs = nodefs) {
4334
// stack[0] holds this file
4435
// stack[1] holds where this function was called
4536
// stack[2] holds the file we're interested in
4637
const position = 2;
47-
if (position < Error.stackTraceLimit && process.platform !== "win32") {
38+
if (position < Error.stackTraceLimit) {
4839
const orig_prepareStackTrace = Error.prepareStackTrace;
4940
let stack;
5041
try {
@@ -56,7 +47,11 @@ function findReactNativeConfig(fs = nodefs) {
5647

5748
if (Array.isArray(stack)) {
5849
const callsite = stack[position];
59-
if (callsite && typeof callsite === "object" && "getFileName" in callsite) {
50+
if (
51+
callsite &&
52+
typeof callsite === "object" &&
53+
"getFileName" in callsite
54+
) {
6055
const file = callsite.getFileName();
6156
if (path.basename(file).startsWith("react-native.config.")) {
6257
return file;

0 commit comments

Comments
 (0)