Re:How JavaScript works: inside the V8 engine
by jFlatz on Monday August 21, 2017 @12:30PM
(#15065717)
I feel like this is one of those things that I have been thinking to my self for a little while now. "Why hasn't someone already solved this problem." In my mind there is no reason for my browser to download 26 copies of the same jquerry file.
[ Parent
| on HN ]
Re:How JavaScript works: inside the V8 engine
by cpeterso on Monday August 21, 2017 @01:02PM
(#15065928)
Here is a proposal to use the hashes from <script> elements' Subresource Integrity attributes to cache JavaScript. There are some concerns about leaking users' browsing history based on resource load times.
https://hillbrad.github.io/sri-addressable-caching/sri-addre...
Re:How JavaScript works: inside the V8 engine
by ChrisSD on Monday August 21, 2017 @01:01PM
(#15065920)
If [websites] use a common CDN then this can be avoided.
[edited, with thanks to delinka]
Re:How JavaScript works: inside the V8 engine
by delinka on Monday August 21, 2017 @01:13PM
(#15065995)
If the sites you're visiting use a common CDN then this can be avoided.
Re:How JavaScript works: inside the V8 engine
by tracker1 on Monday August 21, 2017 @03:16PM
(#15066959)
This was going to be my comment as well.. I tend to prefer cdnjs for as much as possible, since it seems to be the most diverse CDN in terms of supported libraries.
Though I've been trending away from using most libraries separately and bundling... may need to think about breaking things out again. For the most part, however, most of my bundle sizes are pretty small. React in dev, Preact for prod is the biggest mix... checking bundle size before/after adding a module (some will add a huge dependency tree).
There's no substitution for being judicious... and imho, even if you have to look it up frequently, using the DOM is usually better than loading in jQuery... even if you center around Array.from(document.querySelectorAll('...')) as your main usage.