question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Monorepo with React Native + Next.js

See original GitHub issue

Hello 👋 We built a nextjs website with trpc and it has worked wonderful 🙌 Now we’re migrating the website to react-native and have setup a monorepo with yarn workspace and lerna to keep backend in nextjs, but have the frontend in react-native. To share code I’m extracting the trpc code to a common-package and get some error. It’s probably due to bad tsconfig (I’m not yet an ts-expert…).

This error occurs when building the nextjs project:

../common/utils/trpc-client.ts:14:14
Type error: Exported variable 'trpc' has or is using name 'UseTRPCInfiniteQueryOptions' from external module "mono/node_modules/@trpc/react/dist/declarations/src/createReactQueryHooks" but cannot be named.

  12 |  */
  13 |
> 14 | export const trpc = createReactQueryHooks<AppRouter>();
     |              ^
  15 |
  16 | export const transformer = superjson;
  17 |
error Command failed with exit code 1.

I don’t understand the errormessage. But if i go inte node_modules/@trpc/react/dist/declarations/createReactQueryHooks.d.ts and export all interfaces (e.g the UseTRPCInfiniteQueryOptions-interface) the error goes away.

My question is; Does anyone understand the error and know how I should config my tsconfig to solve this? Or, is this something that could be fixed by a version-update on trpc? 🙏

// Christopher

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:4
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
cNillecommented, Aug 11, 2021

Would love having a chat with you about the setup, I’ll book a slot 🥳 I have a similar setup that you propose but with the packages web, app, and common. The common-package both contains the trpc routers, but also some react-code so that we in the future can share it with the web using react-native-web. I’ll look into the repo for inspiration until our meeting.

0reactions
github-actions[bot]commented, Oct 5, 2022

This issue has been locked because it had no new activity for 14 days. If you are running into a similar issue, please create a new issue. Thank you.

Read more comments on GitHub >

github_iconTop Results From Across the Web

React Native + Next.js Monorepo - ecklf.com
Our goal for this blog post is to have a basic monorepo setup that contains one bare React Native app and one Next.js...
Read more >
GitHub - axeldelafosse/expo-next-monorepo-example
Here is an example showing how to create a universal React app using Expo and Next.js in a monorepo. You'll find included: Expo...
Read more >
Turborepo & React Native Starter - Vercel
This is an official starter Turborepo with a Next.js site, a React Native app, and two local packages. Framework Next.js, React. Use Case...
Read more >
Create a Monorepo of React Native and NextJS - Medium
This post will cover steps to create a monorepo of React Native and NextJS . Getting Started Let's say that the folder structure...
Read more >
Learn how to build a monorepo in Next.js - LogRocket Blog
A monorepo is a single version-controlled repository that contains several isolated projects with well-defined relationships.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found