If the whole point of PAYG is to eliminate unused code from being included in the final app distribution, then I'd like to suggest that we take advantage of the tools the JavaScript ecosystem already has for eliminating unused code.
I think we should take a look at Webpack [1] and create a compilation pipeline that feeds into Webpack to create the final compacted distributable app. [1] https://webpack.js.org/guides/tree-shaking/