You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I’m working with Turborepo and I want to use internal "Just-in-Time" packages where the package.json exports reference the TypeScript source files (as described here). However, I also need to be able to compile these packages and publish them to NPM. Here's my current setup:
Repo Structure:
apps/web (using Vite, TypeScript)
packages/somename (TypeScript, planned to be published)
The goal is for the web app to directly import the internal package with .ts/.d.ts files while developing, but for anyone who installs the package from NPM, it should use the built files (e.g., .js, .d.ts in dist).
Has anyone been able to achieve what I’m describing? Or is there a better way to accomplish this?
Could it work to create a purely internal package for shared code and a separate public package that simply re-exports/bundles it for NPM?
Would love to hear if anyone has tackled a similar challenge or has recommendations. Thanks!
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Summary
I’m working with Turborepo and I want to use internal "Just-in-Time" packages where the package.json exports reference the TypeScript source files (as described here). However, I also need to be able to compile these packages and publish them to NPM. Here's my current setup:
Repo Structure:
apps/web (using Vite, TypeScript)
packages/somename (TypeScript, planned to be published)
The goal is for the web app to directly import the internal package with .ts/.d.ts files while developing, but for anyone who installs the package from NPM, it should use the built files (e.g., .js, .d.ts in dist).
Has anyone been able to achieve what I’m describing? Or is there a better way to accomplish this?
Could it work to create a purely internal package for shared code and a separate public package that simply re-exports/bundles it for NPM?
Would love to hear if anyone has tackled a similar challenge or has recommendations. Thanks!
Additional information
No response
Example
No response
Beta Was this translation helpful? Give feedback.
All reactions