Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure global objects initialization for web #3418

Merged
merged 4 commits into from
Aug 5, 2022
Merged

Conversation

piaskowyk
Copy link
Member

Description

The PR with tree shaking moved global objects initialization for web to another file and then imported it into the index file (import './reanimated2/js-reanimated/global';). However, the Webpack can lazy import modules, but we don't have any call to this module, so global objects were never initialized.

Fixes #3355

@piaskowyk piaskowyk requested a review from tomekzaw July 28, 2022 09:21
@piaskowyk piaskowyk self-assigned this Jul 28, 2022
src/index.ts Outdated Show resolved Hide resolved
src/reanimated2/js-reanimated/global.ts Outdated Show resolved Hide resolved
@piaskowyk piaskowyk requested a review from tomekzaw August 5, 2022 12:07
@piaskowyk piaskowyk merged commit 97410ab into main Aug 5, 2022
@piaskowyk piaskowyk deleted the @piaskowyk/fix-i3355 branch August 5, 2022 17:25
piaskowyk added a commit that referenced this pull request Aug 17, 2022
The PR with tree shaking moved global objects initialization for web to another file and then imported it into the `index` file (`import './reanimated2/js-reanimated/global';`). However, the Webpack can lazy import modules, but we don't have any call to this module, so global objects were never initialized.

Fixes #3355
in another way, the bundler can remove unused variables.
*/
console.error('[Reanimated] Unable to initialize global objects for web.');
}
Copy link

@andrewjack-cat andrewjack-cat Oct 10, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was this change supposed to be applied to the src/index.web.ts file instead?

fluiddot pushed a commit to wordpress-mobile/react-native-reanimated that referenced this pull request Jun 5, 2023
## Description

The PR with tree shaking moved global objects initialization for web to another file and then imported it into the `index` file (`import './reanimated2/js-reanimated/global';`). However, the Webpack can lazy import modules, but we don't have any call to this module, so global objects were never initialized.

Fixes software-mansion#3355
@jer-sen
Copy link

jer-sen commented Jul 13, 2023

@piaskowyk it does not solve anything since you did not applied the fix to index.web.ts which is the file executed on Web...

@piaskowyk
Copy link
Member Author

The index.web.ts file was added after this PR, and we rewrite this part and got rid of those changes so this PR is no longer related.

@jer-sen
Copy link

jer-sen commented Jul 15, 2023

I'm with react-native-reanimated@2.14.4 (last version for Expo SDK 48) and there is the PR's code in index.ts but not in the existing index.web.ts...

@oleg3505
Copy link

Hello I'm also working with react-native-reanimated@2.14.4 (Expo SDK 48) and the error with _frameTimestamp is not defined is still here for web

@piaskowyk
Copy link
Member Author

Did you try Reanimated3?

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.

[Web]ReferenceError: _frameTimestamp is not defined
5 participants