Fix file path separator compatibility in scripts/babel (#24318)

The problem in scripts\babel\transform-object-assign.js is that file path separator has '/' and '\' between Linux, MacOS and Windows, which causes yarn build error. See https://github.com/facebook/react/issues/24103
This commit is contained in:
Zhongjan
2022-04-08 19:47:31 +01:00
committed by GitHub
parent bafe912a5f
commit a9add2fe08
+2 -2
View File
@@ -28,7 +28,7 @@ module.exports = function autoImporter(babel) {
visitor: {
CallExpression: function(path, file) {
if (file.filename.indexOf('shared/assign') !== -1) {
if (/shared(\/|\\)assign/.test(file.filename)) {
// Don't replace Object.assign if we're transforming shared/assign
return;
}
@@ -40,7 +40,7 @@ module.exports = function autoImporter(babel) {
},
MemberExpression: function(path, file) {
if (file.filename.indexOf('shared/assign') !== -1) {
if (/shared(\/|\\)assign/.test(file.filename)) {
// Don't replace Object.assign if we're transforming shared/assign
return;
}