15
ultrono
7y

It's pretty common the hear developers moan about JQuery being imported to select an element. That's fair enough and I've sighed inside about that myself before.

However, I've come across an odd one. I'm looking a JavaScript file here that's close to 600KB in size.

528KB of that file is the Loadash library (which is excellent btw). The actual site uses the "join" function (https://lodash.com/docs/4.17.4#join).

I mean seriously wtf, face palms all around.

JQuery, for all it's faults is always cited in such circumstances i.e. being used unnecessarily. However, such things are not limited to Jquery alone unfortunately.

I'm now going to do some serious optimization and cut a 600KB file to ~80KB.

*** facepalm ***

Comments
  • 1
    Lol. Nice. You can score some office praise now 😄
  • 0
    Just read that back. The loadash library has been imported in its entirety so the developer could use the "join" function.
  • 2
    The "join" function? But isn't that in the Array class?

    Also, if you are using npm and some build tool, you can change it to "const join = require('lodash/join');"
  • 2
    And it's "lodash", not "loadash". *insert Hermione meme here*
Add Comment