'how can I assert minified javascript is equivalent to source

I'm writing a webapp and I import a lot of minified JS libraries

Assuming they all minified using terser which is used by js-minify

How can I assert (or score) the source (which I have) is equal to the minified version ?

  • not all of them are signed and have sourceMappingURL

All I can think of is comparing AST trees using a greedy algorithm



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source