Closed tom-sherman closed 1 year ago
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.
Reproduction:
deno run --allow-all scripts/build_npm.ts
Actual behaviour:
npm/src/deps/deno.land/std@0.145.0/bytes/mod.ts
contains unused exportsDesired 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)