Skip to content

Commit 70160cc

Browse files
committed
docs: update docs to match image inline limit
close #2106
1 parent c42cb94 commit 70160cc

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

docs/guide/html-and-static-assets.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,22 @@ will be compiled into:
125125
h('img', { attrs: { src: require('./image.png') }})
126126
```
127127

128-
Internally, we use `file-loader` to determine the final file location with version hashes and correct public base paths, and use `url-loader` to conditionally inline assets that are smaller than 10kb, reducing the amount of HTTP requests.
128+
Internally, we use `file-loader` to determine the final file location with version hashes and correct public base paths, and use `url-loader` to conditionally inline assets that are smaller than 4kb, reducing the amount of HTTP requests.
129+
130+
You can adjust the inline file size limit via [chainWebpack](../config/#chainwebpack). For example, to set the limit to 10kb instead:
131+
132+
``` js
133+
// vue.config.js
134+
module.exports = {
135+
chainWebpack: config => {
136+
config.module
137+
.rule('images')
138+
.use('url-loader')
139+
.loader('url-loader')
140+
.tap(options => Object.assign(options, { limit: 10240 }))
141+
}
142+
}
143+
```
129144

130145
### URL Transform Rules
131146

0 commit comments

Comments
 (0)