Replies: 4 comments
-
|
I'm now working on Turborepo docs 3 days a week, I'm making this one of my top priorities. |
Beta Was this translation helpful? Give feedback.
-
|
Since the docs and the examples recommend next-transpile-modules, I think it is important to check its implication when building apps. For instance, just tried to build an internal package on top of @emotion/server which is widely used for enabling styling SSR with Next.js and depending on whether this package is installed only at the internal package level, at the consuming next app level or at the root of a pnpm workspace, the server bundle is not consistent size-wise. I imagine this can also be the case with other third-party packages so it may be worth checking into this. |
Beta Was this translation helpful? Give feedback.
-
|
I imagine typeRoots being consulted during module resolution can have a positive effect on the first bullet of my original post. |
Beta Was this translation helpful? Give feedback.
-
|
Hey, Kyle, thanks for these notes. Really helpful! TL;DR: We need to find a balance on creating examples that are a great start for understanding monorepos. Not too little, not too much. I personally think we're pretty close and we can continue to do better. Direct answers to your questions at the bottom. My initial reaction on these is that those of us on the Turborepo team want to be mindful of our role in the ecosystem today. Matt did an excellent job with his work on these and I spent the first couple weeks of my time here as Turbo DX working on the examples, too. Here are my thoughts (with emojis on where I personally think we stand right now, today):
The last bullet point is really what makes expanding the examples tough - and leads me to the "don't" category:
There are probably more list items I can add to the above context but hopefully it paints a good enough picture of what we're looking for:
Some additional useful context may be that I asked the Next.js team about their examples directory. To make a long story short, they've said it's too big. We're going to piggyback on that experience and try to keep things more lean here in Turbo. Directly answering your questions to the best of my knowledge finally
Thanks again for your thoughtfulness here, Kyle! |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I wanted to open this as an issue to make it actionable, but I just wanted to point out that a LOT is left unsaid in multiple examples which is going to lead to issues or FAQ. Most of the issues are centered on the fact that users are encouraged to transpile across packages to avoid extra build steps. I opened this issue to get some answers before I attempt to improve the examples with some PRs 🙏🏼
For example:
tsconfig, you need to also map them to the tsconfig of consuming libraries. The approved answer in this discussion is actually potentially disastrous if there exists a module in the application's filesystem when the user meant to reference a package's filesystem. I tried to solve this by usingno-restricted-importslint rule to ban relative imports and encourage devs to use a path that DID NOT exist in consuming apps. For example, if every app hadpaths: { '~/*': ['./*'] }defined, the library will need to dopaths: { '@root': './index.ts' }. My solution could still fail somebody someday since it's theoretically possible that an application could create a similar alias.next-transpile-modulesis encouraged, introducing Storybook leads to a lot of consequences. For example, at that point, somebody would need to installReactas a devDep, but this could lead to an application shipping multiple instances of React (as covered here innext-transpile-modulesdocs). I don't see a perfect solution to this problem andnext-transpile-modules's documentation also acknowledges that their recommended solution isn't perfect. Rather than document, it may be best to change all the examples to have a build step to avoid this issue, but maybe somebody has a better idea or maybe the preference is to encourage transpiling and updating the examples to count for these issues? One last point on Storybook, the dev server has a cache folder which could be used toturborepo's advantage (node_modules/.cache/storybook). Doing an example with Storybook could help for that reason alone.workspaces:*and others are installed via the package name with the "any version" indicator (*). I thinkworkspaces:*is the reason this occurs because I install "packages" in "apps" with no type acquisition issues.Beta Was this translation helpful? Give feedback.
All reactions