React Native, iOS bundling failed: useUnicodeFlag is not a valid regexpu-core option

Viewed 988
node_modules/react-native/Libraries/LogBox/Data/parseLogBoxLog.js:
/Users/rakshithkumars/Number-Guessing/node_modules/react-native/Libraries/LogBox/Data/parseLogBoxLog.js: 
.useUnicodeFlag is not a valid regexpu-core option.
2 Answers

I fixed it in this way:

Run:

yarn add @babel/plugin-proposal-unicode-property-regex --dev

or

npm install --save-dev @babel/plugin-proposal-unicode-property-regex

Then open you babel.config.js file, which may be something like this:

module.exports = function (api) {
  api.cache(true);
  return {
    presets: ['babel-preset-expo'],
  };
};

And add this line:

plugins: ['@babel/plugin-proposal-unicode-property-regex'],

It should end up something like this:

module.exports = function (api) {
  api.cache(true);
  return {
    presets: ['babel-preset-expo'],
    plugins: ['@babel/plugin-proposal-unicode-property-regex'],
  };
};

Note: This shouldn't change anything, but, before trying this change, I migrated from Node 14 to Node 16. Should not affect, but... Mentioning it just in case.

Note 2: It was not necessary to run expo r -c in my case.

Experienced the same issue and fixed it by adding the following plugin to babel.config.js:

@babel/plugin-proposal-unicode-property-regex 

Then ran expo r -c to clear the cache

Related