Browse Source

add production tips info

dev
Evan You 8 years ago
parent
commit
aa6f7b4cdb
  1. 13
      src/entries/web-runtime.js
  2. 9
      test/helpers/to-have-been-warned.js

13
src/entries/web-runtime.js

@ -37,6 +37,15 @@ Vue.prototype.$mount = function (
return this._mount(el, hydrating)
}
if (process.env.NODE_ENV !== 'production' &&
inBrowser && typeof console !== 'undefined') {
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(() => {
@ -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'
)
}

9
test/helpers/to-have-been-warned.js

@ -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()

Loading…
Cancel
Save