I tried to set image but vuejs automatically convert it to base64 if the image is too small, If I resize the image, it works. Is there any explanation?
Asked
Active
Viewed 529 times
0
-
Are you saying you are getting data-uri's for small images? And everything is ok and you just curios about it? If so I would say it is webpack base64-inline-loader module. – farincz May 11 '20 at 12:54
-
I simply wrote
– user3351236 May 11 '20 at 13:49
1 Answers
2
Late reply but answering for people stumbling upon this.
The url-loader
webpack plugin does this and is included by default. To disable it, simply add this to your vue.config.js
:
module.exports = {
// ...
chainWebpack: config => {
config.module
.rule('images')
.use('url-loader')
.loader('url-loader')
.tap(options => {
// Do not base64 encode images URLs
options.limit = -1;
return options;
})
}
}
See original answer on another question.

malandles
- 21
- 6