diff --git a/packages/uni-cli-i18n/locales/zh_CN.json b/packages/uni-cli-i18n/locales/zh_CN.json index 8a51edab91d58e3dacc7ee87372c3fd92ab78935..8f5dda83887d053a62c4d8c9b97655a4e5901dcc 100644 --- a/packages/uni-cli-i18n/locales/zh_CN.json +++ b/packages/uni-cli-i18n/locales/zh_CN.json @@ -54,7 +54,7 @@ "pluginUni.pluginNameNotExist": "插件名称不存在", "pluginUni.pluginIllegal": "插件不合法", "pluginUni.uniStatisticsNoAppid": "当前应用未配置Appid,无法使用uni统计,详情参考 {{0}}", - "pluginUni.uniStatisticsNoVersion": "当前应用未配置uni统计版本,默认使用1.0版本;建议使用uni统计2.0版本 ,私有部署数据更安全,代码开源可定制。详情:{{0}}", + "pluginUni.uniStatisticsNoVersion": "当前应用未配置uni统计版本,默认使用1.0版本;建议使用uni统计2.0版本,私有部署数据更安全,代码开源可定制。详情:{{0}}", "pluginUni.pleaseConfigScriptName": "请指定 package.json->uni-app->scripts 下的 script 名称", "pluginUni.mpBrowserKernelDifference": "小程序各家浏览器内核及自定义组件实现机制存在差异,可能存在样式布局兼容问题,参考:{{0}}", "mpLoader.firstParameterNeedStaticString": "{{0}}的第一个参数必须为静态字符串", diff --git a/packages/vue-cli-plugin-uni/lib/env.js b/packages/vue-cli-plugin-uni/lib/env.js index bc1b48f3a61169e52c98bdd830a58c188a73d3e4..0d362d650b089019d9148bdbf62ae03036c7c00a 100644 --- a/packages/vue-cli-plugin-uni/lib/env.js +++ b/packages/vue-cli-plugin-uni/lib/env.js @@ -9,7 +9,7 @@ require('./error-reporting') const hasOwnProperty = Object.prototype.hasOwnProperty -function hasOwn (obj, key) { +function hasOwn(obj, key) { return hasOwnProperty.call(obj, key) } @@ -291,11 +291,12 @@ if (platformOptions.usingComponents === true) { // 兼容历史配置 betterScopedSlots const modes = ['legacy', 'auto', 'augmented'] -const scopedSlotsCompiler = !platformOptions.scopedSlotsCompiler && platformOptions.betterScopedSlots ? modes[2] - : platformOptions.scopedSlotsCompiler +const scopedSlotsCompiler = !platformOptions.scopedSlotsCompiler && platformOptions.betterScopedSlots ? modes[2] : + platformOptions.scopedSlotsCompiler process.env.SCOPED_SLOTS_COMPILER = modes.includes(scopedSlotsCompiler) ? scopedSlotsCompiler : modes[1] // 快手小程序、小红书小程序 抽象组件编译报错,如未指定 legacy 固定为 augmented 模式 -if ((process.env.UNI_PLATFORM === 'mp-kuaishou' || process.env.UNI_PLATFORM === 'mp-xhs') && process.env.SCOPED_SLOTS_COMPILER !== modes[0]) { +if ((process.env.UNI_PLATFORM === 'mp-kuaishou' || process.env.UNI_PLATFORM === 'mp-xhs') && process.env + .SCOPED_SLOTS_COMPILER !== modes[0]) { process.env.SCOPED_SLOTS_COMPILER = modes[2] } @@ -309,23 +310,23 @@ if ( ) if (uniStatistics.enable === true) { - process.env.UNI_USING_STAT = uniStatistics.version === '2' ? '2' : '1' - if (process.env.NODE_ENV === 'production') { - if (!process.UNI_STAT_CONFIG.appid) { - console.log() - console.warn(uniI18n.__('pluginUni.uniStatisticsNoAppid', { - 0: 'https://ask.dcloud.net.cn/article/36303' - })) - console.log() - } else { - if(!uniStatistics.version) { - console.log() - console.warn(uniI18n.__('pluginUni.uniStatisticsNoVersion', { - 0: 'https://uniapp.dcloud.io/uni-stat' - })) - console.log() - } - } + process.env.UNI_USING_STAT = uniStatistics.version === '2' ? '2' : '1' + if (process.env.NODE_ENV === 'production') { + if (!process.UNI_STAT_CONFIG.appid) { + console.log() + console.warn(uniI18n.__('pluginUni.uniStatisticsNoAppid', { + 0: 'https://ask.dcloud.net.cn/article/36303' + })) + console.log() + } else { + if (!uniStatistics.version) { + console.log() + console.warn(uniI18n.__('pluginUni.uniStatisticsNoVersion', { + 0: 'https://uniapp.dcloud.io/uni-stat' + })) + console.log() + } + } } } } @@ -343,9 +344,9 @@ if (process.env.UNI_USING_COMPONENTS) { // 是否启用分包优化 } const warningMsg = - usingComponentsAbsent - ? '该应用之前可能是非自定义组件模式,目前以自定义组件模式运行。非自定义组件已于2019年11月1日起停止支持。详见:https://ask.dcloud.net.cn/article/36385' - : 'uni-app已于2019年11月1日起停止支持非自定义组件模式 [详情](https://ask.dcloud.net.cn/article/36385)' + usingComponentsAbsent ? + '该应用之前可能是非自定义组件模式,目前以自定义组件模式运行。非自定义组件已于2019年11月1日起停止支持。详见:https://ask.dcloud.net.cn/article/36385' : + 'uni-app已于2019年11月1日起停止支持非自定义组件模式 [详情](https://ask.dcloud.net.cn/article/36385)' const needWarning = !platformOptions.usingComponents || usingComponentsAbsent let hasNVue = false @@ -434,9 +435,9 @@ if (process.env.UNI_PLATFORM === 'mp-toutiao' || process.env.UNI_PLATFORM === 'm if (runByHBuilderX) { const oldError = console.error - console.error = function (msg) { + console.error = function(msg) { if (typeof msg === 'string' && msg.includes( - '[BABEL] Note: The code generator has deoptimised the styling of')) { + '[BABEL] Note: The code generator has deoptimised the styling of')) { const filePath = msg.replace('[BABEL] Note: The code generator has deoptimised the styling of ', '').split( ' as ')[0] console.log('[' + uniI18n.__('warning') + '] `' + path.relative(process.env.UNI_INPUT_DIR, filePath) +