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 5c56ec6b0e4b29b791b18fe17d87ef7e42ea496e..2d81fda2cb51e8248d4fc1081365e96af2b5e600 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,