I'm writing a web application where, to avoid a big JS file to load full of code that is rarely used, I decided to modularize and load the modules once they are needed.
The loading works fine: Each piece of JS code is correctly loaded and executed; I used the jQuery method "append" to append a <script>
at the end of the <head>
.
You can see the result on the picture below.
But now the question came when I'd like to remove the code that I no longer need.
I know Facebook has already met the issue due to their big JS size, but on the speech (https://jmperezperez.com/facebook-frontend-javascript/) it seems that they acted as "optimization" of the JS code moving things from the client to the server.
Any idea or clue is strongly welcome.
Thank you very much for your answers.