Skip to content

Commit

Permalink
Fix file path separator compatibility in scripts/babel (#24318)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
zjfresh authored Apr 8, 2022
1 parent bafe912 commit a9add2f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions scripts/babel/transform-object-assign.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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;
}
Expand Down

0 comments on commit a9add2f

Please sign in to comment.