-
I was looking at the ts-monorepo/packages/nextjs/tsconfig.json Lines 11 to 14 in 0ad8608 And I'm trying to understand why you have remapped I also don't understand how the external dependencies of Side note: would you like to enable GitHub Discussions in this repository? I would have created a discussion instead of a repo. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 9 replies
-
@PaulRBerg the Every example in Examples in |
Beta Was this translation helpful? Give feedback.
-
It wouldn't if you mixed both approaches. You can use path aliases in development and build from artifacts, and this would be beneficial in case you have many apps that depend on common packages and you don't want to compile the common packages every time. Compiling in topological order (with lerna, pnpm, yarn etc.) would speed things up, but it's worth comparing the improvements to the potential cost of having 2 build process (1 for local dev, 1 for building/deploying). Things could get out of sync and cause subtle problems. There's no right answer here though and you can start with 1 approach and then migrate to the other as circumstances dictate.
It should work if things are built in topological order and the package manager sets up the proper Deleting this path alias that's used to resolve If you run `@components` is resolved before via a path alias (omitted here), and `@foo` is resolved via `node_modules`.
|
Beta Was this translation helpful? Give feedback.
@PaulRBerg the
nextjs
branch is quite old , the latest NextJS example is under apps/nextjs.Every example in
apps/*
uses path aliases to load dependencies from the monorepo source code, instead of from build artifacts, both when building and when running e.g. dev servers. This doesn't rely onnode_modules
symlinks, but on TypeScript's resolution mechanisms, and makes "Go to definition" work as expected.Examples in
packages/*
do usenode_modules
symlinks to build artifacts, but only when building. See also https://github.com/NiGhTTraX/ts-monorepo/tree/1ee87c100a3bd65ebae4eb000c76354532f70c09#packages-vs-apps.