Is your feature request related to a problem? Please describe.
Currently the generated code is not optimal and is larger than required. There are several techniques that can be used to assist with the minification of the generated code.
Describe the solution you'd like
By default the generated code uses multiple instances of global scope names and keywords that can be replaced with local scoped variables that can be minified to a smaller net usage.
e.g.
Instead of multiple usages of ClassName.prototype.XXXX (which can't be minified) you can assign this to a local variable such as var proto = ClassName.prototype; proto.XXXX.
This technique works only when un-minifable references are used more than once so that the nett effect is a smaller codebase.
Additional context
As a general SDK, every byte counts especially on slower connections or mobile devices.
@MSNev any update to this ?
Nothing yet! We have only applied some simple basic improvements, but not the full/big changes.
But it is getting close.
To support this I recently created and published a helper utility to the community DynamicProto-JS
https://github.com/microsoft/DynamicProto-JS
This will be used to remove the usages of the typescript ClassName.prototype.XXXX and hide the internal properties (those starting with "_") so they are not exposed on the instance and therefore will be correctly minified.
One known outstanding item that I don't currently have a solution for is that as part of using DynamicProto-JS the DTS needs to change the methods to optional (for compile errors only) even though they will always be defined.
Plus one on this one!
It's my second largest dependency in my node_modules. My only dependency larger than app insights is core-js and I can still trim those down. Shipping with 303kb is very large for what the library is doing.

Any updates here?
@danieljaguiar rather than taking a big bang approach we are doing this in smaller chunks, in the next few months we will be spending some time refactoring some of the bigger items, but you will already see some changes (even though the total size is still a lot larger than I'd like) where we have introduced the DynamicProto() module and refactored some of the modules we have recently made changes on (like the dependencies module).
My next major target will be the sender channel.
@danieljaguiar rather than taking a big bang approach we are doing this in smaller chunks...
Can't wait!
Today (applicationinsights-web 2.5.8) is the largest package in my build. Given that I don't strictly need it for the application to be functional, I'm considering to drop it (and azure insights) every so often...
Most helpful comment
Can't wait!
Today (
applicationinsights-web 2.5.8) is the largest package in my build. Given that I don't strictly need it for the application to be functional, I'm considering to drop it (and azure insights) every so often...