Skip to content

Dynamic import(t) in 3.21.0 breaks Metro bundler (Expo web) #13650

@timbtimbtimb

Description

@timbtimbtimb

mapbox-gl-js version

v3.21.0

Browser and version

No response

Expected behavior

mapbox-gl should bundle successfully with Metro (the default bundler for React Native and Expo web), as it did in 3.20.0.

Actual behavior

Web bundling fails because Metro cannot process the variable dynamic import(t) call introduced in 3.21.0 for TileProvider loading in dist/mapbox-gl.js.

Link to the demonstration

No response

Steps to trigger the unexpected behavior

  1. Create an Expo app with bundler: 'metro' for web
  2. Install mapbox-gl@3.21.0
  3. Import mapbox-gl in a .web.tsx file
  4. Run expo start --web

Relevant log output

Web Bundling failed 11479ms node_modules/expo-router/entry.js (2318 modules)
 ERROR  Error: node_modules/mapbox-gl/dist/mapbox-gl.js:Invalid call at line 13: import(t)
    at transformJS (/##############/app/node_modules/@expo/metro-config/build/transform-worker/metro-transform-worker.js:337:23)
    at transformJSWithBabel (/############/app/node_modules/@expo/metro-config/build/transform-worker/metro-transform-worker.js:487:18)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions