结合url-loader和qcdn的功能,相当于丰富url-loader的功能,最常见的场景:图片如果大于一定尺寸,则上传到公司的cdn上
qnpm中有功能一样的qcdn-loader,但是不支持qcdn参数设置
qnpm install --save-dev @q/qcdn-url-loader
在webpack
的loader中使用,替换url-loader:
include: /img/,
use: [
{
//loader: 'url-loader',
loader: '@q/qcdn-url-loader',
options: {
limit: 100,
qcdnOptions:{
https: true,
force: true
},
name: 'images/[name]-[hash:5].[ext]'
}
}
]
options中的参数和url-loader保持一致,qcdnOptions和qcdn中的options保持一致 如果不传入qcdnOptions参数,则和url-loader功能一致
有任何疑问请联系(siwangli@360.cn)