Skip to content

Instantly share code, notes, and snippets.

@52cik
Created April 10, 2020 14:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 52cik/ef11307a89c755dadf4599b80697eaf2 to your computer and use it in GitHub Desktop.
Save 52cik/ef11307a89c755dadf4599b80697eaf2 to your computer and use it in GitHub Desktop.
vue config Component img src resolving - vue 自定义图片组件 src 解析配置
/** @type {import('@vue/cli-service').ProjectOptions} */
module.exports = {
chainWebpack(config) {
// https://bootstrap-vue.js.org/docs/reference/images/
// https://github.com/webpack-contrib/html-loader
config.module
.rule('vue')
.use('vue-loader')
.loader('vue-loader')
.tap((options) => {
options.transformAssetUrls = {
img: 'src',
MyImg: 'src',
'my-img': 'src',
};
return options;
});
},
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment