#When is transpilePackages necessary?

5 messages · Page 1 of 1 (latest)

sullen patrol
#

I'm setting up a new turborepo monorepo with some nextjs 14 apps.

I have apps/web and apps/docs as test applications and they both use a packages/ui component library. When I run a dev server, I see no difference using transpilePackages: ['@repo/ui'] or not. I guess I'm not understanding what it's doing and why/when I need it. Wouldn't those internal packages be included anyway in dev/builds because I'm importing their code?

silk flaxBOT
#

🔎 This post has been indexed in our web forum and will be seen by search engines so other users can find it outside Discord

🕵️ Your user profile is private by default and won't be visible to users outside Discord, if you want to be visible in the web forum you can add the "Public Profile" role in id:customize

✅ You can mark a message as the answer for your post with Right click -> Apps -> Mark Solution
(if you don't see the option, try refreshing Discord with Ctrl + R)

lethal venture
#

If you look here.
https://nextjs.org/docs/app/api-reference/next-config-js/transpilePackages
It states that Next JS will automatically transpile and bundle packages from monorepos.
The only time I had to use transpilePackages is when I was using the crypto package. https://github.com/brix/crypto-js/issues/415#issuecomment-1837938710

Automatically transpile and bundle dependencies from local packages (like monorepos) or from external dependencies (node_modules).

sullen patrol
#

I did read that, but I guess I'm not clear on why it's needed. I think it's because I'm importing files from another internal package that would not be "available" if I built this project because unlike node_modules/depedencies, I'd have to tell nextjs to bundle them

#

when I run dev mode, they're available because my whole monorepo is avail, but if I were to deploy the nextjs app, those internal modules wouldn't be included by default?