Vue DevTools存在,但未显示任何内容

时间:2019-04-16 03:34:28

标签: javascript node.js vue.js webpack

首先,我确定Vue DevTools可以在我的Chrome和其他项目中正常使用。但是,我发现的这个问题来自我的一位同事。这是我所做的:

我从git克隆了项目,

'npm install&npm run dev'工作正常,

我访问了本地主机上的服务器,并通过快捷方式打开了开发人员工具,然后...

Vue DevTools的选项卡出现了,但是里面什么也没有。

哦,是的,它在vue徽标的左上角显示了“ Ready Detected Vue 2.6.7”。

  

npm:6.9.0,vue:2.6.7,vue devtools:5.0.9

我尝试从webpack中删除devtool配置和devServer压缩配置,但它们似乎没有用。

// webpack.dev.conf.js
const devWebpackConfig = merge(baseWebpackConfig, {
  module: {
    rules: utils.styleLoaders({
      sourceMap: config.dev.cssSourceMap,
      usePostCSS: true
    })
  },
  // cheap-module-eval-source-map is faster for development
  devtool: config.dev.devtool,

  // these devServer options should be customized in /config/index.js
  devServer: {
    clientLogLevel: 'warning',
    historyApiFallback: {
      rewrites: [
        {
          from: /.*/,
          to: path.posix.join(config.dev.assetsPublicPath, 'index.html')
        }
      ]
    },
    hot: true,
    contentBase: false, // since we use CopyWebpackPlugin.
    compress: true,
    host: HOST || config.dev.host,
    port: PORT || config.dev.port,
    open: config.dev.autoOpenBrowser,
    overlay: config.dev.errorOverlay
      ? { warnings: false, errors: true }
      : false,
    publicPath: config.dev.assetsPublicPath,
    proxy: config.dev.proxyTable,
    quiet: true, // necessary for FriendlyErrorsPlugin
    watchOptions: {
      poll: config.dev.poll
    }
  },
  plugins: [
    new webpack.DefinePlugin({
      'process.env': require('../config/dev.env')
    }),
    new webpack.HotModuleReplacementPlugin(),
    new webpack.NamedModulesPlugin(), // HMR shows correct file names in console on update.
    new webpack.NoEmitOnErrorsPlugin(),
    // copy custom static assets
    new CopyWebpackPlugin([
      {
        from: path.resolve(__dirname, '../static'),
        to: config.dev.assetsSubDirectory,
        ignore: ['.*']
      },
      {
        from: './src/assets/favicon.ico',
        to: config.build.assetsRoot
      }
    ])
  ].concat(utils.HtmlWebpackPlugins_dev('index.html'))
})

module.exports = new Promise((resolve, reject) => {
  portfinder.basePort = process.env.PORT || config.dev.port
  portfinder.getPort((err, port) => {
    if (err) {
      reject(err)
    } else {
      // publish the new Port, necessary for e2e tests
      process.env.PORT = port
      // add port to devServer config
      devWebpackConfig.devServer.port = port

      // Add FriendlyErrorsPlugin
      devWebpackConfig.plugins.push(new FriendlyErrorsPlugin({
        compilationSuccessInfo: {
          messages: [`Your application is running here: http://${devWebpackConfig.devServer.host}:${port}`],
        },
        onErrors: config.dev.notifyOnErrors
        ? utils.createNotifierCallback()
        : undefined
      }))

      resolve(devWebpackConfig)
    }
  })
})

这是我的代码,这个devtools问题有什么建议吗?

仍然感谢

0 个答案:

没有答案