Skip to content

Commit f99f21c

Browse files
committedNov 17, 2020
fix(dev): allow performance marking in production
close #11775 Similar to devtools, `Vue.config.devtools` is enabled by default for development and disabled by default for production. However, the developer can choose to override that behavior (for example, for debugging) by manually setting `Vue.config.devtools = true`. However, this same lenience is not afforded to `Vue.config.performance`. Even if explicitly enabling it, the developer's setting will be overridden by Vue in production. This commit brings `Vue.config.performance` in line with `Vue.config.devtools`, by disabling it by default in production, but gives the developer the ability to explicitly enable it; for example, for debugging performance issues.
1 parent b800e8e commit f99f21c

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed
 

‎packages/weex-vue-framework/factory.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -4236,7 +4236,7 @@ function mountComponent (
42364236

42374237
var updateComponent;
42384238
/* istanbul ignore if */
4239-
if (process.env.NODE_ENV !== 'production' && config.performance && mark) {
4239+
if (config.performance && mark) {
42404240
updateComponent = function () {
42414241
var name = vm._name;
42424242
var id = vm._uid;
@@ -5161,7 +5161,7 @@ function initMixin (Vue) {
51615161

51625162
var startTag, endTag;
51635163
/* istanbul ignore if */
5164-
if (process.env.NODE_ENV !== 'production' && config.performance && mark) {
5164+
if (config.performance && mark) {
51655165
startTag = "vue-perf-start:" + (vm._uid);
51665166
endTag = "vue-perf-end:" + (vm._uid);
51675167
mark(startTag);
@@ -5200,7 +5200,7 @@ function initMixin (Vue) {
52005200
callHook(vm, 'created');
52015201

52025202
/* istanbul ignore if */
5203-
if (process.env.NODE_ENV !== 'production' && config.performance && mark) {
5203+
if (config.performance && mark) {
52045204
vm._name = formatComponentName(vm, false);
52055205
mark(endTag);
52065206
measure(("vue " + (vm._name) + " init"), startTag, endTag);

‎src/core/instance/init.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export function initMixin (Vue: Class<Component>) {
2020

2121
let startTag, endTag
2222
/* istanbul ignore if */
23-
if (process.env.NODE_ENV !== 'production' && config.performance && mark) {
23+
if (config.performance && mark) {
2424
startTag = `vue-perf-start:${vm._uid}`
2525
endTag = `vue-perf-end:${vm._uid}`
2626
mark(startTag)
@@ -59,7 +59,7 @@ export function initMixin (Vue: Class<Component>) {
5959
callHook(vm, 'created')
6060

6161
/* istanbul ignore if */
62-
if (process.env.NODE_ENV !== 'production' && config.performance && mark) {
62+
if (config.performance && mark) {
6363
vm._name = formatComponentName(vm, false)
6464
mark(endTag)
6565
measure(`vue ${vm._name} init`, startTag, endTag)

‎src/core/instance/lifecycle.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ export function mountComponent (
168168

169169
let updateComponent
170170
/* istanbul ignore if */
171-
if (process.env.NODE_ENV !== 'production' && config.performance && mark) {
171+
if (config.performance && mark) {
172172
updateComponent = () => {
173173
const name = vm._name
174174
const id = vm._uid

‎src/platforms/web/entry-runtime-with-compiler.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ Vue.prototype.$mount = function (
5858
}
5959
if (template) {
6060
/* istanbul ignore if */
61-
if (process.env.NODE_ENV !== 'production' && config.performance && mark) {
61+
if (config.performance && mark) {
6262
mark('compile')
6363
}
6464

@@ -73,7 +73,7 @@ Vue.prototype.$mount = function (
7373
options.staticRenderFns = staticRenderFns
7474

7575
/* istanbul ignore if */
76-
if (process.env.NODE_ENV !== 'production' && config.performance && mark) {
76+
if (config.performance && mark) {
7777
mark('compile end')
7878
measure(`vue ${this._name} compile`, 'compile', 'compile end')
7979
}

0 commit comments

Comments
 (0)
Failed to load comments.