feat(Worklets): use .native.ts suffix for native-only files and .ts for web-only files#8371
Merged
feat(Worklets): use .native.ts suffix for native-only files and .ts for web-only files#8371
Conversation
Merged
github-merge-queue bot
pushed a commit
that referenced
this pull request
Oct 23, 2025
Required for - #8371 ## Summary This PR is an ongoing effort to reduce the impact of Reanimated and Worklets in web bundles and to simplify the logic of platform-dependent code. The ideal solution is to have native-only files with a `.native.ts` extension and web only files with just `.ts` extension alongside them. However, currently we also have `.web.ts` files, which can be problematic in some environments. We want to transition to `.native.ts` files gradually. This PR does a few things: - It edits TSConfigs alongside the repository. By default we specify that accepted extensions are `.native.ts`, `.ios.ts`, `.android.ts`, `.ts` (obviously also `.tsx` etc.). This means that when in IDE we click `go to source` we'll go to a `.native` file which is the most common use case for us. Also types for type-checking will be pulled like this. - We add additional TSConfigs for web types. These extensions ignore `.native` .etc. extensions and accept `.web` extensions. You can switch to those TSConfigs for web type-checking in your IDE. - Adding type checking scripts and CI checks for web types. - Fixing (or ignoring) all current problems with web types - i.e. mismatching web and native types in Reanimated. - Amending eslint configs to properly work in this setup. ## Test plan CI
MatiPl01
approved these changes
Oct 27, 2025
Member
MatiPl01
left a comment
There was a problem hiding this comment.
Looks good. Left just a few nits.
packages/react-native-worklets/src/debug/WorkletsError.native.ts
Outdated
Show resolved
Hide resolved
github-merge-queue bot
pushed a commit
that referenced
this pull request
Oct 28, 2025
## Summary Unfortunately a typical Jest setup in React Native pulls code from `.native` files which don't make sense to be tested and implemented for Jest environment. For this case we implement a full mock of Worklets to use in testing. Extracted from: - #8371 In another PR all uses of `IS_JEST` will be removed from Worklets. ## Test plan Run Jest tests in Worklets and Reanimated.
github-merge-queue bot
pushed a commit
that referenced
this pull request
Oct 29, 2025
## Summary Fixing minor issues after merging - #8371 ## Test plan Run example app with & without Bundle Mode
4 tasks
This was referenced Dec 8, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
A better approach than
To reduce the impact React Native Worklets have in web environments and simplify ifs for given platforms, I moved all native-only code to
.nativefiles and kept web-specific implementations in.tsfiles. This is due to fact that React Native always pulls.nativefiles first but some web environments don't prefer.webfiles.TODO: Measure bundle size impact.
Test plan