Skip to content

Commit 988fa12

Browse files
committedMar 14, 2016
control devtools availability behind config flag (close vuejs#2453)
1 parent f873613 commit 988fa12

File tree

3 files changed

+21
-11
lines changed

3 files changed

+21
-11
lines changed
 

‎src/batcher.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ function flushBatcherQueue () {
4242
runBatcherQueue(userQueue)
4343
// dev tool hook
4444
/* istanbul ignore if */
45-
if (devtools) {
45+
if (devtools && config.devtools) {
4646
devtools.emit('flush')
4747
}
4848
resetBatcherState()

‎src/config.js

+7
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,13 @@ const config = {
3535

3636
warnExpressionErrors: true,
3737

38+
/**
39+
* Whether to allow devtools inspection.
40+
* Disabled by default in production builds.
41+
*/
42+
43+
devtools: process.env.NODE_ENV !== 'production',
44+
3845
/**
3946
* Internal flag to indicate the delimiters have been
4047
* changed.

‎src/index.js

+13-10
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import Vue from './instance/vue'
22
import installGlobalAPI from './global-api'
33
import { inBrowser, devtools } from './util/index'
4+
import config from './config'
45

56
installGlobalAPI(Vue)
67

@@ -10,14 +11,16 @@ export default Vue
1011

1112
// devtools global hook
1213
/* istanbul ignore next */
13-
if (devtools) {
14-
devtools.emit('init', Vue)
15-
} else if (
16-
process.env.NODE_ENV !== 'production' &&
17-
inBrowser && /Chrome\/\d+/.test(window.navigator.userAgent)
18-
) {
19-
console.log(
20-
'Download the Vue Devtools for a better development experience:\n' +
21-
'https://github.com/vuejs/vue-devtools'
22-
)
14+
if (config.devtools) {
15+
if (devtools) {
16+
devtools.emit('init', Vue)
17+
} else if (
18+
process.env.NODE_ENV !== 'production' &&
19+
inBrowser && /Chrome\/\d+/.test(window.navigator.userAgent)
20+
) {
21+
console.log(
22+
'Download the Vue Devtools for a better development experience:\n' +
23+
'https://github.com/vuejs/vue-devtools'
24+
)
25+
}
2326
}

0 commit comments

Comments
 (0)
Please sign in to comment.