Why does tsup bundle devDependencies instead of dependencies? #1154
Replies: 1 comment
-
I was combing through the issues and I think I may have found the answer here:
I guess I understand this in the context of a "development asset" specifically published as an "npm package" that is going to be used in a dev environment and then bundled again as part of another build step. But it doesn't really make sense if the package/module is designed to be published itself as a runtime asset. How would you build your output for publishing to CDN, it didn't look like there was a way to customize this behavior. Is that still the case? |
Beta Was this translation helpful? Give feedback.
-
If I use frontend projects as an example,
dependencies
are usually the deps that are expected to be bundled into the production distributable, anddevDependencies
are the ones that are only used during development or as part of the build process/tooling.Node/NPM docs state:
And scanners like Snyk tend to call out vulnerabilities in
dependencies
as impacting, but those indevDependencies
as not.When using
tsup
I'm using it to as a bundler to "build for production", so I would expect it to produce a package/module for use in another project that includes anydependencies
and none of thepeerDependencies
ordevDependencies
.For example, if I'm building a...
lodash
function, then I would expect that to be independencies
and it would be bundledbuf
I would want the@bufbuild/buf
runtime as independencies
and would expect it to be part of the published bundleAdditionally, things like
typescript
,tsup
,eslint
are all indevDependencies
and I wouldn't want those being accidentally bundled.As you can probably tell, I found the default behavior of
tsup
a bit backwards, but perhaps I'm misunderstanding something about deps? Or maybe I'm missing a setting somewhere?Any clarity would be appreciated
Beta Was this translation helpful? Give feedback.
All reactions