Should jQuery or another third-party library be combined with logical code?

Frontend developers currently have tools such as webpack, a browser for combining javascript files. If the scripts are running on the server, packaging seems to be better than downloading each file at a time. But if we deploy the client-side script, do we always need to combine all the scripts in one file? Or just code written by us?

For example, jQuery is a very popular third-party library that is used everywhere. If we use webpack to bind jQuery to our boolean code, yes, it reduces the HTTP request time, but it drops the browser cache, which can reduce more traffic if the user visits the site again or there are several pages that use jQuery.

So my question is: should we always bundle all the code together to reduce single-pass traffic or deploy common third-party libraries used, especially when using npm / bower + webpack / browsify / elixir. What is the best practice?

+4
source share
1 answer

, jQuery , jQuery . , , - . jQuery, .

, .

+5

Source: https://habr.com/ru/post/1621479/


All Articles