Best way to use project references inside a Nextjs app #34008
Unanswered
rock-it-rob
asked this question in
Questions
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I've been following the guides I see on the Nx site and the typescript site for setting up project references, but I've come to a situation where I need some guidance.
What I'm sharing here is a very small reproduction of a larger, confidential project but it's enough to demonstrate my issue. This sample project looks like this:
What I want to accomplish is typechecking all projects and their test files.
The libs are fine and work great. Nextjs is the issue. Nextjs will overwrite the
tsconfig.jsonfile every time it runs if it doesn't find options it wants and is totally oblivious to project references. This is an open issue with Nextjs. I can work around it, but just mentioning it here for reference.Attempting to follow the Nx guide here: https://nx.dev/docs/technologies/typescript/guides/switch-to-workspaces-project-references
results in a conflict between what Nextjs wants and what Typescript wants. Nextjs wants noEmit set to true but project references require declaration files to be emitted. So the options I can see are:
OR
I've gone with the second option in this test repository but is there's a better way to accomplish this?
Here's my code:
https://github.com/rock-it-rob/nx-sample
Beta Was this translation helpful? Give feedback.
All reactions