Rollup-plugin-typescript2: Do you really need rpt2?

Created on 2 Nov 2019  ·  4Comments  ·  Source: ezolenko/rollup-plugin-typescript2

What happens and why it is wrong

Related to #79 and #148

Just a quick PSA in case it will help people out. I was using this plugin because it was convenient but building would take 2gb of memory and a long time. I narrowed down the issue to this plugin. Now I'm simply using tsc then plugging in the js input to rollup instead and my build time is down about 5x and memory down about 100x.

I'm not knocking on the hard work @ezolenko (thanks for the plugin) has done in this project, and I'm sure it's still useful to those with smaller projects, but if you're like me and see performance issues, think if you really need this plugin because the perf costs are high.

Just my 2 cents...

Versions

  • typescript: 3.6.4
  • rollup: 1.26.3
  • rollup-plugin-typescript2: 0.25.1
help wanted question

Most helpful comment

@mikob

Now I'm simply using tsc then plugging in the js input to rollup instead and my build time is down about 5x and memory down about 100x.

Thanks for the data point, as someone still trying to decided if I want to start my next TS library with Rollup, can you give us a summary of how you did this?

All 4 comments

Yep, convenience has a price. :) If anybody has an idea of how to speed it up, make a PR :)

@mikob

Now I'm simply using tsc then plugging in the js input to rollup instead and my build time is down about 5x and memory down about 100x.

Thanks for the data point, as someone still trying to decided if I want to start my next TS library with Rollup, can you give us a summary of how you did this?

@mikob

Now I'm simply using tsc then plugging in the js input to rollup instead and my build time is down about 5x and memory down about 100x.

I am also interested in your solution. The entry point usually imports a bunch of other modules, so we use rollup to bundle them all into a single file. tsc only supports single outfile for "AMD" and "System" module format.

@adrianmcli @sntran I'm using the typescript compiler API and the rollup API in a script. Basically, like this:

watchTs(); const watcher = rollup.watch(rollupConfig);

watchTs does a lot of boilerplate ts things (they don't make their API easy). You can start by looking at ts.createWatchCompilerHost

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kyle-johnson picture kyle-johnson  ·  10Comments

alireza-salemian picture alireza-salemian  ·  4Comments

brandon-leapyear picture brandon-leapyear  ·  7Comments

alexsasharegan picture alexsasharegan  ·  14Comments

vwxyutarooo picture vwxyutarooo  ·  15Comments