I'm making a Chrome extension with thousands of lines of JavaScript. It would be madness to put them all into one file, especially when it is vanilla JS and is therefore not very structured or modular
It seems like a sensible solution by breaking into multiple scripts, but in my case the speed is exactly Important, if I separate a single JavaScript file from a dozen, then do I see a conscious display drop?
I suspect that the difference will be noticeable on websites, however, you will usually be able to use several files And then there will be a build process that combines and compresses all your Javascript files together, which reduces HTTP requests. If you are worried about this, then the same technique can be applied to the Chrome extension.
No comments:
Post a Comment