Plugin/Preset files are not allowed to export objects, only functions

Hi.
I just updated my app to use SDK 31.0.0.

After I did that I get an error when I run the App in Expo Client/simulator: Plugin/Preset files are not allowed to export objects, only functions. I don’t understand what the error means, so I don’t’ know what to do. I see that @darryl had the same issue about a month ago, but no answer was added. "Preset files are not allowed to export objects, only functions" when updating RN version - #2

I hope someone might be able to assist this time?

Hey @vayu,

I believe this is usually a problem with Babel which might make sense here as SDK31 added support for Babel 7. Did you have custom babel settings? If so, can you make sure you’ve upgraded to babel-preset-expo@5. If you didn’t have any custom settings, I would peruse these issues and see if anything helps.

Cheers,

Adam

Hi Adam.
Thanks for your suggestion.
I don’t have any custom babel settings. And all those issues your link leads to are regarding custom babel settings, so I’m not sure how to fix this regarding Expo SDK.

I think the next best step would be to try creating a fresh Expo project with expo init and seeing if it throws the error. If it doesn’t, I’m thinking it may be related to a dependency in your main project. I would then go ahead and add a dependency one by one and see if that helps track down the culprit.

I found that I had a .babelrc file that had some settings that needed deleting.
I deleted this:

"env": {
    "development": {
      "plugins": ["transform-react-jsx-source"]
    }
  }
1 Like

Glad you got it figured out!

Yeah, thanks for helping :slight_smile:

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.