Skip to content

fix: support SDK 54 BaseMods API and multiple widget-type targets#180

Open
jackrobinsonuk wants to merge 1 commit intoEvanBacon:mainfrom
jackrobinsonuk:fix/sdk54-basemods-multiple-widget-targets
Open

fix: support SDK 54 BaseMods API and multiple widget-type targets#180
jackrobinsonuk wants to merge 1 commit intoEvanBacon:mainfrom
jackrobinsonuk:fix/sdk54-basemods-multiple-widget-targets

Conversation

@jackrobinsonuk
Copy link
Copy Markdown

@jackrobinsonuk jackrobinsonuk commented Mar 1, 2026

Problem

Two independent bugs that surface together when using this package with Expo SDK 54 and multiple type: "widget" targets.

Bug 1 — BaseMods.withGeneratedBaseMods / BaseMods.provider removed in SDK 54

BaseMods.withGeneratedBaseMods and BaseMods.provider were removed from the BaseMods object in SDK 54's @expo/config-plugins. They are now standalone exports from @expo/config-plugins/build/plugins/createBaseMod. With the old import, prebuild fails immediately with BaseMods.provider is not a function.

Bug 2 — Multiple type: "widget" targets clobber each other

Both home screen widgets and Live Activities share the com.apple.widgetkit-extension extension point identifier. getExtensionTargets() returns all targets of that type. When a project has more than one, the ?? targets[0] fallback in applyXcodeChanges silently picks the first existing target instead of creating a new one — clearing its buildConfigurationList reference and then crashing on:

TypeError: [ios.xcodeProjectBeta2]: withIosXcodeProjectBeta2BaseMod:
Cannot read properties of undefined (reading 'removeFromProject')
    at applyXcodeChanges (with-xcode-changes.js:200:53)

Fix

  • Bug 1: Replace BaseMods import with direct named imports of provider and withGeneratedBaseMods from @expo/config-plugins/build/plugins/createBaseMod
  • Bug 2: Remove the ?? targets[0] fallback — if no target matches by productName, let it fall through to the creation path so each uniquely-named target is always created independently

Testing

Validated locally against a real production app that has exactly the Bug 2 crash scenario — three type: "widget" targets:

Target Bundle ID
habits_widget com.fittech.habits_widget
hydration_widget com.fittech.hydration_widget
live_activity com.fittech.app.LiveActivity

The patched build was dropped into the app's node_modules and npx expo prebuild --platform ios --clean was run. Prebuild completed successfully with all three widget targets created independently.

Test plan

  • bunx expo-module typecheck passes
  • bun test (unit tests) passes
  • E2E tests (bun run test:e2e)
Screenshot 2026-03-01 at 15 47 50 Screenshot 2026-03-01 at 15 47 35 Screenshot 2026-03-01 at 15 46 52

Closes #144

@jackrobinsonuk
Copy link
Copy Markdown
Author

Hey @EvanBacon - have you had chance to look at this please?

@JustJoostNL
Copy link
Copy Markdown

@EvanBacon Would love to see this! Currently it's impossible to separate widgets/live activities across multiple targets, which is important to avoid hitting the memory limits.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix: @bacons/apple-targets compatibility with Expo SDK 54

2 participants