kubetail-org / loadjs

A tiny async loader / dependency manager for modern browsers (899 bytes)
MIT License
2.57k stars 149 forks source link

Can not detect image if url has ?=rand123456 #96

Closed tinamore closed 4 years ago

tinamore commented 4 years ago

Hi, Has bug in code loadjs: if url image has ?=..... then loadjs not detect is image example:

loadjs(['/images/sprite/hsp2_v2.png?vsk=1564236054', '/images/sprite/hsp1.png?vsk=1564236054'], function() {
  /* cache image */
});

then browser network will load with javascript not image. 2019-08-05_10-39-16

I think regex to css identifier or Image should be:

if (/(^css!|\.css.*$)/.test(path)) {

} else if (/(^img!|\.(png|gif|jpg|svg).*$)/.test(path)) {

Thanks

amorey commented 4 years ago

This has been fixed in v4.0.0: https://github.com/muicss/loadjs/issues/97. Apologies for the delay.