Where static analysis can't work, the JS community is exploring libraries declaring that they're pure: https://github.com/webpack/webpack/blob/master/examples/side-effects/README.md