Can I have turbo build
include an individual "apps" dependencies in the dist
?
#9019
Replies: 2 comments 1 reply
-
I assume that you have package.json file for each app separately and workspaces are set up correctly in the root package.json. Isn't It should be more like yarn/npm/pnpm workspaces magic rather than turbo magic. |
Beta Was this translation helpful? Give feedback.
-
In the end I realized even a simple project without turborepo, just a flat In my simple case it was enough to
import * as esbuild from 'esbuild'
await esbuild.build({
entryPoints: ['src/index.ts'],
bundle: true,
outfile: 'dist/index.js',
platform: 'node'
})
Again this is really outside of the concern of turborepo, but hopefully somebody in a similar confused state might find this. |
Beta Was this translation helpful? Give feedback.
-
Summary
I'm using
turborepo
to build individual Lambda functions, but would like the build output for each app to (optionally) include all of the dependencies from each individual package.json file in node_modules. Looking for some guidance. I'm fairly certain based on my googling so far that "this is the job of a bundler" is the answer, but I'm hoping for a bit more guidance here if possible!Additional information
I have a turborepo setup where each
app
is a different AWS Lambda function (the fact this is Lambda doesn't really matter, but just for context).I am writing everything in TypeScript, and each "app" is very simple generally (one, maybe two TS files). For the most part I have no external dependencies because I'm using the AWS SDK which is available in the Lambda runtime, so I just have it set as a dev dependency for now (again, this doesn't matter but just for context).
I now have a situation where I need to use an external dependency, and my package.json file looks like this:
ksuid
andgraphql
(and their dependency trees) I need to be included with my deployed function and ideally that would mean when I runturbo build
somehow, "magically", turbo does whatever it needs to do to move the dependencies from the shared root node_modules into thedist
.It's outside of the scope of turbo again but for context I'm essentially running
turbo build
followed bycdk deploy
, and each lambda function is being deployed from thedist
directory. So again ideally afterturbo build
all required dependencies would be included in thedist
.I am fairly certain the fact that I'm asking this question means I'm "doing it wrong", but am still hoping for some advice as to how I should be handling this setup - to be entirely honest I'm not even sure using turborepo is the right choice for me here but I've enjoyed working with it in the past with a NextJS project and other than this bundling issue it's been working great for me to manage a lot of individual small apps.
Thank you very much!
Beta Was this translation helpful? Give feedback.
All reactions