Skip to content

[🐛] Config plugin invalid "Unexpected token 'typeof'" with Expo SDK 54 / React Native 0.81 #835

@Vinntoo

Description

@Vinntoo

%23%23 Bug Report

%23%23%23 Environment

  • react-native-google-mobile-ads: ^16.0.3
  • Expo SDK: 54.0.33
  • React Native: 0.81.5
  • React: 19.1.0
  • New Architecture: Enabled
  • Platform: Android

%23%23%23 What happened%3F

When running the project with Expo SDK 54 and React Native 0.81.5, two errors occur:

  1. Package "react-native-google-mobile-ads" does not contain a valid config plugin.
  2. Unexpected token 'typeof'

The package is configured as an Expo config plugin in app.json as documented:

{
  "expo": {
    "plugins": [
      [
        "react-native-google-mobile-ads",
        {
          "androidAppId": "ca-app-pub-xxxxxxxxxxxxxxxx~xxxxxxxxxx",
          "iosAppId": "ca-app-pub-xxxxxxxxxxxxxxxx~xxxxxxxxxx"
        }
      ]
    ]
  }
}

The first error suggests the package does not export a valid Expo config plugin. The second error (Unexpected token 'typeof') appears to be a syntax parsing issue in the plugin code, possibly due to TypeScript syntax not being compiled correctly for the Expo config plugin entry point.

%23%23%23 Steps to Reproduce

  1. Create a new Expo SDK 54 project with React Native 0.81.5
  2. Install react-native-google-mobile-ads@^16.0.3
  3. Add the plugin config to app.json as shown above
  4. Run npx expo prebuild or npx expo start

%23%23%23 Expected Behavior

The config plugin should be recognized and applied without errors during prebuild/start.

%23%23%23 Actual Behavior

Two errors are thrown:

Package "react-native-google-mobile-ads" does not contain a valid config plugin.
Learn more: https://docs.expo.dev/guides/config-plugins/%23creating-a-plugin

Unexpected token 'typeof'

%23%23%23 package.json Dependencies

{
  "expo": "~54.0.33",
  "react": "19.1.0",
  "react-native": "0.81.5",
  "react-native-google-mobile-ads": "^16.0.3"
}

This may be a compatibility issue between v16 of this package and Expo SDK 54 / React Native 0.81.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions