vue.js - vue-devtools 总是被 nuxt.js 禁用

标签 vue.js nuxt.js vue-devtools

我正在使用 nuxt.js v2.3.0 创建一个新项目。当我在我的 IDE 控制台中运行 npm run dev 时,一切都可以正确编译,但是当我转到该页面时,我收到以下错误:Nuxt.js + Vue.js is detected on this page。 Devtools 检查不可用,因为它处于生产模式或被作者明确禁用。

这是我的 nuxt.config.js 文件:

const pkg = require('./package');

module.exports = {
  mode: 'spa',

  dev: true,
  /*
  ** Headers of the page
  */
  head: {
    title: pkg.name,
    meta: [
      { charset: 'utf-8' },
      { name: 'viewport', content: 'width=device-width, initial-scale=1' },
      { hid: 'description', name: 'description', content: pkg.description }
    ],
    link: [
      { rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }
    ],
    bodyAttrs: {
      class: 'h-100'
    },
    htmlAttrs: {
      class: 'h-100'
    }
  },

  /*
  ** Global CSS
  */
  css: [
    '@/assets/app.css'
  ],

  /*
  ** Plugins to load before mounting the App
  */
  plugins: [
    '~/plugins/vue-notifications',
    '~/plugins/vue2-sidebar'
  ],

  /*
  ** Nuxt.js modules
  */
  modules: [
    // Doc: https://github.com/nuxt-community/axios-module#usage
    '@nuxtjs/axios',
    // Doc: https://bootstrap-vue.js.org/docs/
    'bootstrap-vue/nuxt',
    // Doc: https://auth.nuxtjs.org/getting-starterd/setup
    '@nuxtjs/auth',
    '@nuxtjs/toast',
    '@nuxtjs/font-awesome'
  ],
  /*
  ** Axios module configuration
  */
  axios: {
    baseURL: 'http://users:8000'
  },

  /*
  ** Auth module configuration
  */
  auth: {
    strategies: {
      password_grant: {
        _scheme: 'local',
        endpoints: {
          login: {
            url: '/oauth/token',
            method: 'post',
            propertyName: 'access_token'
          },
          logout: 'api/logout',
          user: {
            url: 'api/user',
            method: 'get',
            propertyName: false
          },
        },
        tokenRequired: true,
        tokenType: 'Bearer'
      }
    },
    redirect: {
      login: "/account/login",
      logout: "/",
      callback: "/account/login",
      user: "/"
    },
  },

  /*
  ** Toast configuration
  */
  toast: {
    position: 'top-right',
    duration: 2000
  },


  loading: {
    name: 'chasing-dots',
    color: '#ff5638',
    background: 'white',
    height: '4px'
  },

  /*
  ** Router configuration
  */
  router: {
    middleware: ['auth']
  },

  /*
  ** Build configuration
  */
  build: {
    /*
    ** You can extend webpack config here
    */
    extend(config, ctx) {

    }
  }
};

如果我在生产模式下运行,那么我可以理解,但我不是。我希望 vue-devtools 能正常运行。

最佳答案

我必须将以下内容添加到 nuxt.config.js 中:

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

现在 devtools 出现了

关于vue.js - vue-devtools 总是被 nuxt.js 禁用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53346558/

相关文章:

typescript - Vuex Getters 和 Typescript 错误

html - 使用 "stacked"属性后表标题行消失

javascript - 在 Nuxt.js 中禁用客户端水合或停止在 Nuxt.js 中公开原始数据

Laravel 8 - Jetstream + 惯性.js - Vue 开发工具不工作

vue.js - 我怎样才能让 vue DevTools 自动提交 vuex 突变?

javascript - 如何在不丢失样式的情况下打印vue组件的一部分

javascript - 如何在页面上的多个位置使用相同的组件实例 - Vue2

vue.js - Nuxt SSR - 我无法检查用户是否通过身份验证

vue.js - 如何在 Nuxt 3 中加载外部样式表?

vue.js - Vue Devtools 在本地不工作