Skip to content

Commit

Permalink
fix: windows paths now generated correctly (#445)
Browse files Browse the repository at this point in the history
  • Loading branch information
dannyhw authored Mar 23, 2023
1 parent 8ca0ce1 commit eb101bb
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion app/react-native/scripts/loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,12 @@ function writeRequires({ configPath, absolute = false }) {
const absolutePath = absolute ? requirePath : path.resolve(configPath, requirePath);
const pathRelativeToCwd = path.relative(cwd, absolutePath);

return `"./${pathRelativeToCwd}": require("${requirePath}")`;
const normalizePathForWindows = (str) =>
path.sep === '\\' ? str.replace(/\\/g, '/') : str;

return `"./${normalizePathForWindows(
pathRelativeToCwd
)}": require("${normalizePathForWindows(requirePath)}")`;
});
return [...acc, ...paths];
}, []);
Expand Down

0 comments on commit eb101bb

Please sign in to comment.