file-loader和url-loader的区别

file-loader和url-loader的作用

webpack加载css背景图片、img元素指向的网络图片、使用es6的import引入的图片时,需要使用url-loader或者file-loader。
url-loader和file-loader可以加载任何文件。

区别:

url-loader可以将图片转为base64字符串,能更快的加载图片,一旦图片过大,
就需要使用file-loader的加载本地图片,故url-loader可以设置图片超过多少字节时,使用file-loader加载图片。

猜你喜欢

转载自blog.csdn.net/Menqq/article/details/107743603
今日推荐