首页 > 解决方案 > 如何关闭来自 Nuxt 服务器的 console.info 消息?

问题描述

我正在运行测试并console.info在终端中收到不必要的文本,我想摆脱:

  console.info
    Download the Vue Devtools extension for a better development experience:
    https://github.com/vuejs/vue-devtools

      at node_modules/vue/dist/vue.common.dev.js:9051:47

  console.info
    You are running Vue in development mode.
    Make sure to turn on production mode when deploying for production.
    See more tips at https://vuejs.org/guide/deployment.html

      at node_modules/vue/dist/vue.common.dev.js:9060:45
const { Nuxt } = require('nuxt')
const nuxtConfig = require('../../../../nuxt.config.js')

let nuxt = null

beforeAll(async () => {
  nuxt = new Nuxt({
    ...nuxtConfig,
    buildDir: constants.buildDir
  })

  await nuxt.server.listen(constants.port, 'localhost')
}, 300000)

我尝试将 vue.config 静默属性放在上面代码中的各个位置,但也放入nuxt.config.js,但这样做没有运气。我试过这个片段:https ://nuxtjs.org/docs/2.x/configuration-glossary/configuration-vue-config/

export default {
  vue: {
    config: {
      productionTip: true,
      devtools: false
    }
  }
}

如何关闭console.info消息?

标签: vue.jspycharmnuxt.js

解决方案


您可以右键单击 devtools 控制台中的消息并使用Hide messages from vue.runtime.esm.js. 由于过滤器,它将从您的控制台中隐藏它。不要解决真正的问题,而是一个很好的快速解决方案。

几乎在这里:https ://superuser.com/a/995289/850722


推荐阅读