diff --git a/docs/faq/README.md b/docs/faq/README.md index 0d87a45..56cdfb4 100644 --- a/docs/faq/README.md +++ b/docs/faq/README.md @@ -320,6 +320,17 @@ module.exports = { }; ``` +`vue-cli5` project, use the `asset/inline` of `webpack` replace `url-loader`: + +```js +module.exports = { + chainWebpack: (config) => { + config.module.rule('fonts').type('asset/inline').set('generator', {}); + config.module.rule('images').type('asset/inline').set('generator', {}); + }, +}; +``` + 3. Use the `file-loader` of `webpack` to inject the full path when packaging it (suitable for projects with large font files and images) ```js diff --git a/docs/faq/README.zh.md b/docs/faq/README.zh.md index ec1e666..8dbb26c 100644 --- a/docs/faq/README.zh.md +++ b/docs/faq/README.zh.md @@ -322,6 +322,17 @@ module.exports = { }; ``` +`vue-cli5` 项目,使用 `asset/inline` 替代 `url-loader`,写法: + +```js +module.exports = { + chainWebpack: (config) => { + config.module.rule('fonts').type('asset/inline').set('generator', {}); + config.module.rule('images').type('asset/inline').set('generator', {}); + }, +}; +``` + 3. 借助 `webpack` 的 `file-loader` ,在打包时给其注入完整路径(适用于字体文件和图片体积比较大的项目) ```js