What does grafana-toolkit plugin:build actually do?

My plugin:dev build takes about a minute, but my prod build takes two hours (edit: make that 3.5 hours and I have a crazy 16 core Threadripper with 128GB of RAM). What does it actually do? Why do I care about a prod build - could I just use my dev build all the time? I’ve invested a day trying to speed it up and think it might be short of memory but no amount of max-old-space seems to help.

Some more debug info that might help: I have 3 panel plugins and a data source plugin packaged in an app plugin. They are all tiny but have a dependency on a large 3D library I am using which is almost certainly the culprit. All my code and the library are TypeScript and I’m using the Terser Webpack plugin.

Alternatively suggestions on a node command that would replace the grafana-toolkit would also help as I don’t seem to be able to tweak grafana-toolkit, but I would like to know if I care about a prod build before sinking in more time.

Thanks,
Paul