From 663199d6f6fcc1388dbe853dff0cf02070905b52 Mon Sep 17 00:00:00 2001 From: fxy060608 Date: Wed, 20 Nov 2019 20:37:50 +0800 Subject: [PATCH] feat(v3): disable cache --- .../vue-cli-plugin-uni/lib/app-plus/index.js | 18 ++++++++++++++---- packages/vue-cli-plugin-uni/lib/env.js | 3 ++- 2 files changed, 16 insertions(+), 5 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 a455739fc..dee8ffd06 100644 --- a/packages/vue-cli-plugin-uni/lib/app-plus/index.js +++ b/packages/vue-cli-plugin-uni/lib/app-plus/index.js @@ -11,6 +11,10 @@ const { getPartialIdentifier } = require('../util') +// const { +// createTemplateCacheLoader +// } = require('../cache-loader') + function getProvides () { return { '__f__': [path.resolve(__dirname, '../format-log.js'), 'default'], @@ -23,7 +27,7 @@ const v3 = { vueConfig: { parallel: false }, - webpackConfig (webpackConfig, vueOptions) { + webpackConfig (webpackConfig, vueOptions, api) { const isAppService = !!vueOptions.pluginOptions['uni-app-plus']['service'] const isAppView = !!vueOptions.pluginOptions['uni-app-plus']['view'] @@ -121,6 +125,12 @@ const v3 = { }] }, ...rules + // v3 ζš‚δΈζ”―ζŒ cache + // createTemplateCacheLoader(api, + // isAppService + // ? 'uni-template-compiler-service' + // : 'uni-template-compiler-view' + // ) ] }, plugins: [ @@ -146,12 +156,12 @@ const v3 = { )) } - const compilerOptions = Object.assign({ + const compilerOptions = { isUnaryTag, preserveWhitespace: false, service: isAppService, view: isAppView - }, cacheConfig) + } // disable vue cache-loader webpackConfig.module @@ -164,7 +174,7 @@ const v3 = { isAppView, compiler: getPlatformCompiler(), compilerOptions - })) + }, cacheConfig)) .end() .use('uniapp-custom-block-loader') .loader(require.resolve('@dcloudio/vue-cli-plugin-uni/packages/webpack-custom-block-loader')) diff --git a/packages/vue-cli-plugin-uni/lib/env.js b/packages/vue-cli-plugin-uni/lib/env.js index f6296eede..ecf05f589 100644 --- a/packages/vue-cli-plugin-uni/lib/env.js +++ b/packages/vue-cli-plugin-uni/lib/env.js @@ -125,7 +125,8 @@ if (process.env.UNI_PLATFORM === 'app-plus') { platformOptions.compilerVersion === '3' || platformOptions.compilerVersion === 3 ) - ) { + ) { + delete process.env.UNI_USING_CACHE process.env.UNI_USING_V3 = true platformOptions.usingComponents = true process.env.UNI_OUTPUT_TMP_DIR = '' -- GitLab