From b64bc5dbf93f4a329821f91d97c1f4cd08901d52 Mon Sep 17 00:00:00 2001 From: fxy060608 Date: Mon, 25 Nov 2019 12:07:15 +0800 Subject: [PATCH] feat(v3): change svg,midia limit --- .../vue-cli-plugin-uni/lib/app-plus/index.js | 33 ++++++++++--------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/packages/vue-cli-plugin-uni/lib/app-plus/index.js b/packages/vue-cli-plugin-uni/lib/app-plus/index.js index 5c56ec6b0..2d81fda2c 100644 --- a/packages/vue-cli-plugin-uni/lib/app-plus/index.js +++ b/packages/vue-cli-plugin-uni/lib/app-plus/index.js @@ -145,22 +145,25 @@ const v3 = { const isAppView = !!vueOptions.pluginOptions['uni-app-plus']['view'] // 处理静态资源 - webpackConfig.module - .rule('images') - .use('url-loader') - .loader('url-loader') - .tap(options => Object.assign(options, { - limit: 1, - fallback: { - loader: 'file-loader', - options: { - emitFile: isAppView, - name: '[name].[ext]', - useRelativePath: true, - context: process.env.UNI_INPUT_DIR + const staticTypes = ['images', 'svg', 'media', 'fonts'] + staticTypes.forEach(staticType => { + webpackConfig.module + .rule(staticType) + .use('url-loader') + .loader('url-loader') + .tap(options => Object.assign(options, { + limit: 1, + fallback: { + loader: 'file-loader', + options: { + emitFile: isAppView, + name: '[name].[ext]', + useRelativePath: true, + context: process.env.UNI_INPUT_DIR + } } - } - })) + })) + }) const cacheConfig = { cacheDirectory: false, -- GitLab