-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Add missing @stylexjs/babel-plugin
in web-example
#6886
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
Merged
tomekzaw
merged 4 commits into
main
from
@tomekzaw/fix-web-example-missing-stylex-babel-plugin
Jan 10, 2025
Merged
Add missing @stylexjs/babel-plugin
in web-example
#6886
tomekzaw
merged 4 commits into
main
from
@tomekzaw/fix-web-example-missing-stylex-babel-plugin
Jan 10, 2025
Conversation
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
tjzel
approved these changes
Jan 10, 2025
piaskowyk
approved these changes
Jan 10, 2025
tjzel
pushed a commit
that referenced
this pull request
Feb 17, 2025
## Summary This PR fixes the following errors that occur when trying to run web-example using `yarn start --reset-cache`: ``` Web Bundling failed 174ms apps/web-example/index.js (1 module) ERROR index.js: Cannot find module '@stylexjs/babel-plugin' Require stack: - /Users/tomekzaw/RNOS/react-native-reanimated/apps/web-example/babel.config.js - /Users/tomekzaw/RNOS/react-native-reanimated/node_modules/@babel/core/lib/config/files/module-types.js - /Users/tomekzaw/RNOS/react-native-reanimated/node_modules/@babel/core/lib/config/files/configuration.js - /Users/tomekzaw/RNOS/react-native-reanimated/node_modules/@babel/core/lib/config/files/index.js - /Users/tomekzaw/RNOS/react-native-reanimated/node_modules/@babel/core/lib/index.js - /Users/tomekzaw/RNOS/react-native-reanimated/apps/web-example/node_modules/@expo/metro-config/build/transform-worker/metro-transform-worker.js - /Users/tomekzaw/RNOS/react-native-reanimated/apps/web-example/node_modules/@expo/metro-config/build/transform-worker/transform-worker.js - /Users/tomekzaw/RNOS/react-native-reanimated/node_modules/metro/src/DeltaBundler/Worker.flow.js - /Users/tomekzaw/RNOS/react-native-reanimated/node_modules/metro/src/DeltaBundler/Worker.js - /Users/tomekzaw/RNOS/react-native-reanimated/node_modules/jest-worker/build/workers/processChild.js ``` Then I faced another error: ``` Web Bundling failed 5562ms apps/web-example/index.js (1325 modules) ERROR ReferenceError: SHA-1 for file /Users/tomekzaw/RNOS/react-native-reanimated/node_modules/@react-native/js-polyfills/error-guard.js is not computed. Potential causes: 1) You have symlinks in your project - watchman does not follow symlinks. 2) Check `blockList` in your metro.config.js and make sure it isn't excluding the file path. at DependencyGraph.getSha1 (/Users/tomekzaw/RNOS/react-native-reanimated/node_modules/metro/src/node-haste/DependencyGraph.js:181:13) at Transformer._getSha1 (/Users/tomekzaw/RNOS/react-native-reanimated/node_modules/metro/src/Bundler.js:15:26) at Transformer.transformFile (/Users/tomekzaw/RNOS/react-native-reanimated/node_modules/metro/src/DeltaBundler/Transformer.js:92:19) at Bundler.transformFile (/Users/tomekzaw/RNOS/react-native-reanimated/node_modules/metro/src/Bundler.js:43:30) at processTicksAndRejections (node:internal/process/task_queues:95:5) at Object.transform (/Users/tomekzaw/RNOS/react-native-reanimated/node_modules/metro/src/lib/transformHelpers.js:134:12) at transform (/Users/tomekzaw/RNOS/react-native-reanimated/node_modules/metro/src/DeltaBundler/Graph.js:164:26) at visit (/Users/tomekzaw/RNOS/react-native-reanimated/node_modules/metro/src/DeltaBundler/buildSubgraph.js:82:29) at async Promise.all (index 3) at buildSubgraph (/Users/tomekzaw/RNOS/react-native-reanimated/node_modules/metro/src/DeltaBundler/buildSubgraph.js:103:3) ``` Turns out it's dependent on whether react-native is hoisted or not so I applied the following patch for `metro.config.js` that @tjzel had sent me: ```js const hasReactNative = require.resolve('react-native/package.json', { paths: [projectRoot], }); if (!hasReactNative) { const modulesToBlock = ['@react-native']; // @ts-expect-error config.resolver.blacklistRE = exclusionList( modulesToBlock.map( (m) => new RegExp( `^${escape(path.join(monorepoRoot, 'node_modules', m))}\\/.*$` ) ) ); } ``` Finally, I bumped `react-native-web` and `@expo/metro-runtime` to the latest versions. Now we can launch web-example using `yarn start --reset-cache`. ## Test plan
tjzel
pushed a commit
that referenced
this pull request
Feb 17, 2025
## Summary This PR fixes the following errors that occur when trying to run web-example using `yarn start --reset-cache`: ``` Web Bundling failed 174ms apps/web-example/index.js (1 module) ERROR index.js: Cannot find module '@stylexjs/babel-plugin' Require stack: - /Users/tomekzaw/RNOS/react-native-reanimated/apps/web-example/babel.config.js - /Users/tomekzaw/RNOS/react-native-reanimated/node_modules/@babel/core/lib/config/files/module-types.js - /Users/tomekzaw/RNOS/react-native-reanimated/node_modules/@babel/core/lib/config/files/configuration.js - /Users/tomekzaw/RNOS/react-native-reanimated/node_modules/@babel/core/lib/config/files/index.js - /Users/tomekzaw/RNOS/react-native-reanimated/node_modules/@babel/core/lib/index.js - /Users/tomekzaw/RNOS/react-native-reanimated/apps/web-example/node_modules/@expo/metro-config/build/transform-worker/metro-transform-worker.js - /Users/tomekzaw/RNOS/react-native-reanimated/apps/web-example/node_modules/@expo/metro-config/build/transform-worker/transform-worker.js - /Users/tomekzaw/RNOS/react-native-reanimated/node_modules/metro/src/DeltaBundler/Worker.flow.js - /Users/tomekzaw/RNOS/react-native-reanimated/node_modules/metro/src/DeltaBundler/Worker.js - /Users/tomekzaw/RNOS/react-native-reanimated/node_modules/jest-worker/build/workers/processChild.js ``` Then I faced another error: ``` Web Bundling failed 5562ms apps/web-example/index.js (1325 modules) ERROR ReferenceError: SHA-1 for file /Users/tomekzaw/RNOS/react-native-reanimated/node_modules/@react-native/js-polyfills/error-guard.js is not computed. Potential causes: 1) You have symlinks in your project - watchman does not follow symlinks. 2) Check `blockList` in your metro.config.js and make sure it isn't excluding the file path. at DependencyGraph.getSha1 (/Users/tomekzaw/RNOS/react-native-reanimated/node_modules/metro/src/node-haste/DependencyGraph.js:181:13) at Transformer._getSha1 (/Users/tomekzaw/RNOS/react-native-reanimated/node_modules/metro/src/Bundler.js:15:26) at Transformer.transformFile (/Users/tomekzaw/RNOS/react-native-reanimated/node_modules/metro/src/DeltaBundler/Transformer.js:92:19) at Bundler.transformFile (/Users/tomekzaw/RNOS/react-native-reanimated/node_modules/metro/src/Bundler.js:43:30) at processTicksAndRejections (node:internal/process/task_queues:95:5) at Object.transform (/Users/tomekzaw/RNOS/react-native-reanimated/node_modules/metro/src/lib/transformHelpers.js:134:12) at transform (/Users/tomekzaw/RNOS/react-native-reanimated/node_modules/metro/src/DeltaBundler/Graph.js:164:26) at visit (/Users/tomekzaw/RNOS/react-native-reanimated/node_modules/metro/src/DeltaBundler/buildSubgraph.js:82:29) at async Promise.all (index 3) at buildSubgraph (/Users/tomekzaw/RNOS/react-native-reanimated/node_modules/metro/src/DeltaBundler/buildSubgraph.js:103:3) ``` Turns out it's dependent on whether react-native is hoisted or not so I applied the following patch for `metro.config.js` that @tjzel had sent me: ```js const hasReactNative = require.resolve('react-native/package.json', { paths: [projectRoot], }); if (!hasReactNative) { const modulesToBlock = ['@react-native']; // @ts-expect-error config.resolver.blacklistRE = exclusionList( modulesToBlock.map( (m) => new RegExp( `^${escape(path.join(monorepoRoot, 'node_modules', m))}\\/.*$` ) ) ); } ``` Finally, I bumped `react-native-web` and `@expo/metro-runtime` to the latest versions. Now we can launch web-example using `yarn start --reset-cache`. ## Test plan
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
This PR fixes the following errors that occur when trying to run web-example using
yarn start --reset-cache
:Then I faced another error:
Turns out it's dependent on whether react-native is hoisted or not so I applied the following patch for
metro.config.js
that @tjzel had sent me:Finally, I bumped
react-native-web
and@expo/metro-runtime
to the latest versions.Now we can launch web-example using
yarn start --reset-cache
.Test plan