-
-
Notifications
You must be signed in to change notification settings - Fork 181
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
Need to add @radix-ui/* components directly as dependency or cannot find module #310
Comments
I'm getting this on |
No @alvinometric , because radix is only a dependency in the .web.tsx of the component, which is fine and correct IMO. The metro bundler does not take the dependency in consideration during the bundling process. I feel like it’s an bundling issue, metro should be aware of platforms, but I‘m asking here to check how you guys think about it. :) |
Seems like an expo/bundling issue where changing the web I'm getting a
"node_modules/@rn-primitives/checkbox": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/@rn-primitives/checkbox/-/checkbox-1.1.0.tgz",
"integrity": "sha512-drIWeB41LOkkGDHUKM++7e5vuODB6KeX7qJR3JfYoF0FDRGMG23f3cCo6cQy6DNgsjBctGPpTojQQxuLjuuTWg==",
"dependencies": {
"@radix-ui/react-checkbox": "^1.1.1",
"@rn-primitives/hooks": "1.1.0",
"@rn-primitives/slot": "1.1.0",
"@rn-primitives/types": "1.1.0"
},
"peerDependencies": {
"react": "*",
"react-native": "*",
"react-native-web": "*"
},
"peerDependenciesMeta": {
"react-native": {
"optional": true
},
"react-native-web": {
"optional": true
}
}
},
"node_modules/@rn-primitives/checkbox/node_modules/@radix-ui/react-checkbox": {
"version": "1.1.3",
"resolved": "https://registry.npmjs.org/@radix-ui/react-checkbox/-/react-checkbox-1.1.3.tgz",
"integrity": "sha512-HD7/ocp8f1B3e6OHygH0n7ZKjONkhciy1Nh0yuBgObqThc3oyx+vuMfFHKAknXRHHWVE9XvXStxJFyjUmB8PIw==",
"dependencies": {
"@radix-ui/primitive": "1.1.1",
"@radix-ui/react-compose-refs": "1.1.1",
"@radix-ui/react-context": "1.1.1",
"@radix-ui/react-presence": "1.1.2",
"@radix-ui/react-primitive": "2.0.1",
"@radix-ui/react-use-controllable-state": "1.1.0",
"@radix-ui/react-use-previous": "1.1.0",
"@radix-ui/react-use-size": "1.1.0"
},
"peerDependencies": {
"@types/react": "*",
"@types/react-dom": "*",
"react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc",
"react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc"
},
"peerDependenciesMeta": {
"@types/react": {
"optional": true
},
"@types/react-dom": {
"optional": true
}
}
},
"node_modules/@rn-primitives/checkbox/node_modules/@radix-ui/react-checkbox/node_modules/@radix-ui/react-presence": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/@radix-ui/react-presence/-/react-presence-1.1.2.tgz",
"integrity": "sha512-18TFr80t5EVgL9x1SwF/YGtfG+l0BS0PRAlCWBDoBEiDQjeKgnNZRVJp/oVBl24sr3Gbfwc/Qpj4OcWTQMsAEg==",
"dependencies": {
"@radix-ui/react-compose-refs": "1.1.1",
"@radix-ui/react-use-layout-effect": "1.1.0"
},
"peerDependencies": {
"@types/react": "*",
"@types/react-dom": "*",
"react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc",
"react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc"
},
"peerDependenciesMeta": {
"@types/react": {
"optional": true
},
"@types/react-dom": {
"optional": true
}
}
},
"node_modules/@rn-primitives/checkbox/node_modules/@radix-ui/react-checkbox/node_modules/@radix-ui/react-primitive": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/@radix-ui/react-primitive/-/react-primitive-2.0.1.tgz",
"integrity": "sha512-sHCWTtxwNn3L3fH8qAfnF3WbUZycW93SM1j3NFDzXBiz8D6F5UTTy8G1+WFEaiCdvCVRJWj6N2R4Xq6HdiHmDg==",
"dependencies": {
"@radix-ui/react-slot": "1.1.1"
},
"peerDependencies": {
"@types/react": "*",
"@types/react-dom": "*",
"react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc",
"react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc"
},
"peerDependenciesMeta": {
"@types/react": {
"optional": true
},
"@types/react-dom": {
"optional": true
}
}
}, |
same here. On web doesn't work (easier for the development), but on Expo Go app it works. Needed to be fixed or find some solution for that. |
+1, I gotta go back to my old repo, for now. But looking for some fixes :) |
Describe the bug
Whenever I install a component, for example like:
npx @react-native-reusables/cli@latest add checkbox
and I run the application in a web browser, I get the errorCannot find module '@radix-ui/react-checkbox'
. Same thing for other components, for example with@radix-ui/react-select
. I installed theselect
directly in my project and then it worked, but I think it should also work without me installing the extra dependency, and maybe I'm missing something.To Reproduce
I created a showcase repository that used the steps to reproduce one by one: https://github.com/svenliebig/rn-reusables-bug-showcase
Steps to reproduce the behavior:
npx create-expo-app@latest new-app
cd new-app
npx @react-native-reusables/cli@latest init
(Use@/components
and@/lib
for the import paths of components and lib to conform with expo)npx @react-native-reusables/cli@latest add checkbox
app/(tabs)/index.tsx
:npm start
and pressw
after it finishes. It will open the browserExpected behavior
I should be able to install and use the components without installing
@radix-ui/*
components manually.Screenshots
![image](https://private-user-images.githubusercontent.com/9104499/403355722-86328612-7668-43c7-95ed-9fd098b079a9.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkwNTQzMzQsIm5iZiI6MTczOTA1NDAzNCwicGF0aCI6Ii85MTA0NDk5LzQwMzM1NTcyMi04NjMyODYxMi03NjY4LTQzYzctOTVlZC05ZmQwOThiMDc5YTkucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDIwOCUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTAyMDhUMjIzMzU0WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9NjBhZmRkZTMzYWM4NzBlYjBkYWYyMGZiOTUwYjQxZmE5ZWVjMzFlZDk5YWEzNWJkYzYzOGFjMGRkYjA3MzAyYiZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.pkptg1Y36FBSa8mHLdvSZlUCpCxzZ8IinOGm5-QZf4M)
Platform (please complete the following information):
Additional context
I couldn't find any other issue about this topic, which makes me wonder if I'm doing something completely wrong. I know that the
@radix-ui
components are direct dependencies in the@rn-primitives/
components, and in my opinion I think metro as a bundler or expo as the controlling instance here, should be able to know that there are web, ios and android versions of one and the same component and should be able to resolve these things correctly. However I wanted to ask here first if I do something wrong.Thanks!
The text was updated successfully, but these errors were encountered: