jaredpalmer / tsdx

Zero-config CLI for TypeScript package development
https://tsdx.io
MIT License
11.26k stars 508 forks source link

How to explore bundle size? #741

Closed dgreene1 closed 4 years ago

dgreene1 commented 4 years ago

Hi. I’m using TSDX to create a library, and I’m trying to understand why my bundle size is so large. Is anyone aware of any tooling for that?

(And I’m very sorry that this is something that is probably better suited for stack overflow.)

vndre commented 4 years ago

Hello, TSDX uses Rollup under the hood so extending its config with any plugin should be easy, for the specific task of analyzing your bundle I would suggest: https://github.com/doesdev/rollup-plugin-analyzer

add it like this:

const analyze = require('rollup-plugin-analyzer')
module.exports = {
  rollup(config, options) {
    config.plugins.push(analyze())
    return config
  },
}
agilgur5 commented 4 years ago

I’m trying to understand why my bundle size is so large. Is anyone aware of any tooling for that?

705 uses the size-limit package for this, but there's many different options. rollup-plugin-analyzer is one of them as mentioned above. rollup-plugin-visualizer is mentioned in #496 .

(And I’m very sorry that this is something that is probably better suited for stack overflow.)

Yes, this is out-of-scope and not TSDX-specific. Please recognize that you're requesting volunteer maintainers to spend time to answer here by filing an issue instead of spending more of your time on searching or asking on SO. If you think SO is more appropriate, you should ask there. This is also something you can search about as there's quite a lot of tooling for that and even multiple in issues/PRs/code in this repo alone.