-
-
Notifications
You must be signed in to change notification settings - Fork 609
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
bug: Error: Unable to resolve module @trigger.dev/core/v3 #1490
Comments
Hi there! I understand you're encountering a module resolution error while trying to use @trigger.dev/react-hooks in your React Native project. The error you're seeing suggests there's a compatibility issue between the React Native environment and the @trigger.dev packages. Looking at the underlying issue, this is happening because @trigger.dev/react-hooks is trying to import from @trigger.dev/core/v3, but this dependency isn't being resolved correctly in the React Native environment. Here's what I suggest to resolve this:
npm install @trigger.dev/[email protected] @trigger.dev/[email protected]
{
"dependencies": {
"@trigger.dev/react-hooks": "^3.2.1",
"@trigger.dev/core": "^3.2.1"
}
}
# For Metro bundler
npx react-native start --reset-cache Important considerations:
If you're still experiencing issues after trying these steps, please let me know:
The error appears to be a module resolution issue rather than a functional one, so once we get the packages properly resolved, you should be able to use the React hooks as documented. Let me know if you need any clarification or run into other issues! |
Hey @Cirr0e! I'm also experiencing the following issue using Expo SDK 52. I installed both Here is the list of installed packages for me
As I'm using the default Expo template it doesn't have |
@maxckelly I just understood that @Cirr0e is an automation bot for answers, so probably it won't always respond correctly. Did you resolve the issue for you by any chance? |
Hey there! I see you're having trouble with @trigger.dev packages in your React Native project. This looks like a module resolution issue with Metro bundler, which is quite common when using packages that use ESM imports in a React Native environment. Here's how we can fix this:
const { getDefaultConfig } = require('@expo/metro-config');
const config = getDefaultConfig(__dirname);
// Add this to handle the @trigger.dev packages
config.resolver.extraNodeModules = {
'@trigger.dev/core': require.resolve('@trigger.dev/core'),
'@trigger.dev/react-hooks': require.resolve('@trigger.dev/react-hooks'),
'@trigger.dev/sdk': require.resolve('@trigger.dev/sdk'),
};
// Ensure proper handling of ESM modules
config.resolver.sourceExts = [...config.resolver.sourceExts, 'mjs', 'cjs'];
module.exports = config;
npx react-native start --reset-cache
# or for Expo
npx expo start --clear
{
"expo": {
"experiments": {
"tsconfigPaths": true
}
}
}
{
"dependencies": {
"@trigger.dev/core": "^3.3.5",
"@trigger.dev/react-hooks": "^3.3.5",
"@trigger.dev/sdk": "^3.3.5"
}
} This solution is based on similar module resolution issues seen in React Native projects and the fix that worked for Next.js environments (referenced in issue #930). Let me know if you run into any issues with this setup. You might need to tweak the Metro configuration based on your specific project setup. Also, since you're using Expo SDK 52, which is quite recent, please make sure you have the latest versions of all @trigger.dev packages, as there might be compatibility updates specifically for newer React Native versions. |
@Cirr0e even with the suggested changes the bundling throws the following error
and crashes the Expo Go app on project launch |
Unfortunately haven't solved it yet. I've resorted to using my own backend and calling Trigger api to get results. Not ideal for now but best solution till i have more time to look at it |
Any solutions on this ? |
Provide environment information
"@trigger.dev/react-hooks": "^3.2.1",
React native
Describe the bug
Hi - I'm trying to use the react hooks as stated in the documentation but whenever I try to call authentication or subscribe I get the below error. Can someone please help.
Reproduction repo
https://github.com/triggerdotdev/trigger.dev
To reproduce
Build react native application and install package as stated in docs
Additional information
No response
The text was updated successfully, but these errors were encountered: