Treeshaking of rewritten local dependencies
Reproduction:
- Checkout https://github.com/tom-sherman/response-multipart/commit/ebbe84ee913c7ff87905134ca774baf1f0fde268
- Run
deno run --allow-all scripts/build_npm.ts
Actual behaviour:
npm/src/deps/deno.land/[email protected]/bytes/mod.ts contains unused exports
Desired behaviour:
Only the used exports should be included
It would be good if dnt tried to treeshake unused exports. It's fine if this is best effort IMO (all treeshaking is best effort anyways I believe)
It would be a lot of work to do this. What you could do for now is add a post build step that uses a tool that performs tree shaking on the output.
@dsherret Maybe it could be possible to leverage https://github.com/swc-project/swc/tree/main/crates/swc_bundler for figuring out the dependency graph and performing the tree shaking
This is out of scope for dnt because it's a lot of work. I'd recommend using a separate tool to perform tree shaking on the output.