mirror of
https://github.com/facebook/react-native.git
synced 2026-11-18 20:19:07 +00:00
Fix the path.sep replacement of node-haste for Windows
Summary:
Fix the `path.sep` replacement for Windows, currently it just replace one segment:
```js
// Result: './lib/random\random-byte.js'
'./lib\\random\\random-byte.js'.replace(path.sep, '/')
```
Change to regex will work fine:
```js
// Result: './lib/random/random-byte.js' (correct)
'./lib\\random\\random-byte.js'.replace(new RegExp('\\' + path.sep, 'g'), '/')
```
Closes https://github.com/facebook/react-native/pull/11641
Differential Revision: D4368402
fbshipit-source-id: 46f456359d1cd2ca790881773e8a76af8616cd21
This commit is contained in:
1 parent
199d64083c
commit
2249af16b7
2 files changed
+2
-2
No files matched your search
@@ -77,7 +77,7 @@ module.exports = class Package {
|
||||
|
||||
let relPath = './' + path.relative(this.root, name);
|
||||
if (path.sep !== '/') {
|
||||
relPath = relPath.replace(path.sep, '/');
|
||||
relPath = relPath.replace(new RegExp('\\' + path.sep, 'g'), '/');
|
||||
}
|
||||
|
||||
let redirect = replacements[relPath];
|
||||
|
||||
Reference in new issue
Block a user