@samitouri / QOS-React-2 / commits / a9add2fe08

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

Zhongjan committed Apr 9, 2022 at 02:47 UTC a9add2fe08cc3fa8fc811f6efce84815827fb98c
1 file changed +2 -2
scripts/babel/transform-object-assign.js
+2 -2
@@ -28,7 +28,7 @@ module.exports = function autoImporter(babel) {
28
29 visitor: {
30 CallExpression: function(path, file) {
31 - if (file.filename.indexOf('shared/assign') !== -1) {
31 + if (/shared(\/|\\)assign/.test(file.filename)) {
32 // Don't replace Object.assign if we're transforming shared/assign
33 return;
34 }
@@ -40,7 +40,7 @@ module.exports = function autoImporter(babel) {
40 },
41
42 MemberExpression: function(path, file) {
43 - if (file.filename.indexOf('shared/assign') !== -1) {
43 + if (/shared(\/|\\)assign/.test(file.filename)) {
44 // Don't replace Object.assign if we're transforming shared/assign
45 return;
46 }