Skip to content

Commit

Permalink
add production tips info
Browse files Browse the repository at this point in the history
  • Loading branch information
yyx990803 committed Dec 28, 2016
1 parent 6b1755a commit aa6f7b4
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
13 changes: 11 additions & 2 deletions src/entries/web-runtime.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,15 @@ Vue.prototype.$mount = function (
return this._mount(el, hydrating)
}

if (process.env.NODE_ENV !== 'production' &&
inBrowser && typeof console !== 'undefined') {

This comment has been minimized.

Copy link
@rwu823

rwu823 Dec 30, 2016

Maybe add one more check with Vue.config.devtools is turned on?

This comment has been minimized.

Copy link
@codingcampbell

codingcampbell Dec 30, 2016

@yyx990803 @rwu823 yes please, it's surprising how annoying it is to see this message all the time

This comment has been minimized.

Copy link
@Macavity

Macavity Jan 5, 2017

Or maybe check for Vue.config.silent which should "Suppress all Vue logs and warnings.".

console[console.info ? 'info' : 'log'](
`You are running Vue in development mode.\n` +
`Make sure to turn on production mode when deploying for production.\n` +
`See more tips at https://vuejs.org/guide/deployment.html`
)
}

// devtools global hook
/* istanbul ignore next */
setTimeout(() => {
Expand All @@ -47,8 +56,8 @@ setTimeout(() => {
process.env.NODE_ENV !== 'production' &&
inBrowser && !isEdge && /Chrome\/\d+/.test(window.navigator.userAgent)
) {
console.log(
'Download the Vue Devtools for a better development experience:\n' +
console[console.info ? 'info' : 'log'](
'Download the Vue Devtools extension for a better development experience:\n' +
'https://github.com/vuejs/vue-devtools'
)
}
Expand Down
9 changes: 7 additions & 2 deletions test/helpers/to-have-been-warned.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
function noop () {}

if (typeof console === 'undefined') {
window.console = {
warn: function () {},
error: function () {}
warn: noop,
error: noop
}
}

// avoid info messages during test
console.info = noop

let asserted
function hasWarned (msg) {
var count = console.error.calls.count()
Expand Down

0 comments on commit aa6f7b4

Please sign in to comment.