Skip to content

Commit a9add2f

Browse files
authored
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 #24103
1 parent bafe912 commit a9add2f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

scripts/babel/transform-object-assign.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ module.exports = function autoImporter(babel) {
2828

2929
visitor: {
3030
CallExpression: function(path, file) {
31-
if (file.filename.indexOf('shared/assign') !== -1) {
31+
if (/shared(\/|\\)assign/.test(file.filename)) {
3232
// Don't replace Object.assign if we're transforming shared/assign
3333
return;
3434
}
@@ -40,7 +40,7 @@ module.exports = function autoImporter(babel) {
4040
},
4141

4242
MemberExpression: function(path, file) {
43-
if (file.filename.indexOf('shared/assign') !== -1) {
43+
if (/shared(\/|\\)assign/.test(file.filename)) {
4444
// Don't replace Object.assign if we're transforming shared/assign
4545
return;
4646
}

0 commit comments

Comments
 (0)