vue.config.js里面test(/\.(JPG|PNG)$/)小写的时候jpg图片不显示

VUE配置文件vue.config.js里面config.module.rule('jpg').test(/\.(JPG|PNG)$/)的jpg是小写的时候jpg图片不显示

config.module
      .rule('jpg')
      .test(/\.(JPG|PNG)$/)
      .use('url-loader')
      .loader('url-loader')
      .options({
        limit: 10000
      })
      .end()

大写的时候可以显示,小写的时候require完了出来的base64是很短的一串,图片也是小方块,不能正常显示

我踏马直接疑惑

test(/\.(JPG|PNG)$/)

改为

test(/\.(JPG|PNG)$/i)

正则中/i为不区分大小写

 

也可以改为

test(/\.(JPG|PNG|jpg|png)$/)

直接将小写的jpg png也作为匹配条件