Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
451 views
in Technique[技术] by (71.8m points)

vue cli 3.0 配置url-loader的问题

使用JPG格式的图片时报错

       <img
        class="film-image"
        src="~@/assets/images/CT.JPG"
        alt=""
      >

image.png
jpg格式的文件就没问题,这还分大小写的?

网上查了下需要安装配置file-loader和url-loader,可是3.0的不知道怎么配置,vue.config.js文件的代码如下:

module.exports = {
    chainWebpack: (config) => {
        
        config.module.rule('images')
              .test(/.(png|jpe?g|JPG|gif|svg)(?.*)?$/)
              .use('url-loader')
              .loader('url-loader')
    }
}

不知道是不是我写的不对,还是说需要配置file-loader?其实就算不配置,别的格式的图片都可以,就这个JPG格式不行,vue cli 3.0的写法不太熟,请大佬指教。


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
等待大神解答

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...