Skip to content

fix(ios): avoid WorkletsModule.h import that breaks worklets-enabled builds#1102

Open
Traviskn wants to merge 1 commit into
software-mansion:mainfrom
Traviskn:fix/ios-worklets-build-rnworklets-header
Open

fix(ios): avoid WorkletsModule.h import that breaks worklets-enabled builds#1102
Traviskn wants to merge 1 commit into
software-mansion:mainfrom
Traviskn:fix/ios-worklets-build-rnworklets-header

Conversation

@Traviskn

Copy link
Copy Markdown
Contributor

Fixes #1095

Introduced changes

Building an app with react-native-worklets could fail compiling RNAudioAPI with "'rnworklets/rnworklets.h' file not found", because AudioAPIModule.mm imported <worklets/apple/WorkletsModule.h>, which transitively includes the codegen-generated rnworklets spec header that is not visible to the RNAudioAPI compile unit in all build setups (e.g. prebuilt RNWorklets on EAS builds).

  • Forward-declare the single WorkletsModule method the file actually uses (getWorkletsModuleProxy) instead of importing the full header.
  • Add ReactCodegen header search paths to the worklets-enabled HEADER_SEARCH_PATHS so generated spec headers remain resolvable.

Checklist

  • Linked relevant issue
  • Updated relevant documentation
  • Added/Conducted relevant tests
  • Performed self-review of the code
  • Updated Web Audio API coverage N/A
  • Added support for web N/A
  • Updated old arch android spec file N/A

…builds

Building an app with react-native-worklets could fail compiling
RNAudioAPI with "'rnworklets/rnworklets.h' file not found", because
AudioAPIModule.mm imported <worklets/apple/WorkletsModule.h>, which
transitively includes the codegen-generated rnworklets spec header
that is not visible to the RNAudioAPI compile unit in all build
setups (e.g. prebuilt RNWorklets on EAS builds).

- Forward-declare the single WorkletsModule method the file actually
  uses (getWorkletsModuleProxy) instead of importing the full header.
- Add ReactCodegen header search paths to the worklets-enabled
  HEADER_SEARCH_PATHS so generated spec headers remain resolvable.

Fixes software-mansion#1095

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
DaveDev42 added a commit to DaveDev42/teleprompter that referenced this pull request Jun 12, 2026
…t (upstream #1102) (#634)

## What
Applies upstream PR software-mansion/react-native-audio-api#1102 (open,
unreleased — latest release is our 0.12.2) verbatim as a pnpm patch
(`patches/react-native-audio-api.patch`):
- **AudioAPIModule.mm**: replace `#import
<worklets/apple/WorkletsModule.h>` with a forward-declared `@interface
WorkletsModule` exposing the single method used
(`getWorkletsModuleProxy`) — removes the transitive dependency on the
codegen-generated `<rnworklets/rnworklets.h>` entirely.
- **RNAudioAPI.podspec**: add `Headers/Private/ReactCodegen` +
`build/generated/ios/ReactCodegen` to HEADER_SEARCH_PATHS in both
`pod_target_xcconfig` and `s.xcconfig` (xcconfig-file mechanism — safe,
unlike the buildSettings writes that caused #630/#632).

## Why
EAS preview build `aed88a0c` (first build after the #633 plugin removal)
failed with the ORIGINAL `'rnworklets/rnworklets.h' file not found`.
#633 was still correct — the four `audioapi/core/...` errors are gone.
The rnworklets error was never fixed by #630, only **masked**: the
corrupted builds aborted on the .cpp files before reaching
AudioAPIModule.mm.

EAS-only root cause: on the EAS builder RNWorklets is **prebuilt**,
severing the CocoaPods dependency-header propagation that normally puts
`Headers/Public/ReactCodegen` on RNAudioAPI's search paths. Locally
RNWorklets builds from source, so it never reproduced here. Upstream's
PR comment names this exact scenario.

## Verification (local)
- `expo prebuild -p ios --no-install --clean` + `pod install` →
RNAudioAPI xcconfig carries the new ReactCodegen paths
- `xcodebuild -project Pods/Pods.xcodeproj -target RNAudioAPI
-configuration Release -sdk iphoneos` → **BUILD SUCCEEDED**, zero
errors, AudioAPIModule.mm compiled with the forward-decl (first-ever
local compile of this pod — it landed in #622 after the last local
build)

## Cleanup tracking
Drop the patch when upstream releases #1102 or equivalent (note added to
`.claude/rules/native-build.md`).
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.

EAS iOS Build fails with react-native-worklets: 'rnworklets/rnworklets.h' file not found in AudioAPIModule.mm

1 participant