From 4566cc08cf2b9d2b41cfeb7be668010d7ce89652 Mon Sep 17 00:00:00 2001 From: "K. Shankari" Date: Sat, 21 Dec 2024 11:44:59 -0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=92=9A=20Enable=20babel=20transpiling=20o?= =?UTF-8?q?f=20react-native=20as=20well?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This fixes the code coverage github action. Without this change, we were getting the error ``` i FAIL www/__tests__/DateSelect.test.tsx ● Test suite failed to run SyntaxError: /private/tmp/e-mission-phone/node_modules/react-native/Libraries/vendor/emitter/EventEmitter.js: Unexpected token, expected "]" (39:5) ``` The last successful run was from Oct 17. The first failed run was from Oct 23. We have not made any changes to the react-native components that we directly import since Sept 2024. However, we use a carat semver, so we will pull newly released minor versions. One of our dependencies bumped up the version of RN that they use, and released a new minor version, which broke this. After fruitlessly searching around for a root cause (as documented in the PR comments), since we import a lot of components and it was laborious to check when each of them have been updated, I did a brute force search in GitHub for this error and found both the same issue https://github.com/facebook/react-native/issues/48228 and a fix that worked https://github.com/facebook/react-native/issues/48228#issuecomment-2547160218 I am surprised this has not been reported widely, but I guess it is fairly new! Thanks to @Basil-Code for the suggestion! --- babel.config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/babel.config.js b/babel.config.js index b3c97fe4c..9e4bc46af 100644 --- a/babel.config.js +++ b/babel.config.js @@ -1,4 +1,4 @@ module.exports = { - presets: ['@babel/preset-env', '@babel/preset-typescript', '@babel/preset-react'], + presets: ['@babel/preset-env', '@babel/preset-typescript', '@babel/preset-react', 'module:@react-native/babel-preset'], plugins: ['@babel/plugin-transform-flow-strip-types'], }