简体   繁体   English

vscode调试vuejs在firefox

[英]vscode debugging vuejs in firefox

I have been trying to debug my vuejs app in Firefox but so far i am unable to do it.我一直在尝试在 Firefox 中调试我的 vuejs 应用程序,但到目前为止我无法做到。 Chrome seems to work fine, but in Firefox breakpoints do not work. Chrome 似乎工作正常,但在 Firefox 断点不起作用。

There is no error, the app just runs without stopping on breakpoints.没有错误,应用程序只是运行而不会在断点处停止。

I am using the config from official vuejs cookbook我正在使用官方 vuejs食谱中的配置

{
  "version": "0.2.0",
  "configurations": [
    {
      "type": "chrome",
      "request": "launch",
      "name": "vuejs: Chrome",
      "url": "http://localhost:8080",
      "webRoot": "${workspaceFolder}/src",
      "breakOnLoad": true,
      "sourceMapPathOverrides": {
        "webpack:///src/*": "${webRoot}/*"
      }
    },
    {
      "type": "firefox",
      "request": "launch",
      "name": "vuejs: firefox",
      "url": "http://localhost:8080",
      "webRoot": "${workspaceFolder}/src",
      "pathMappings": [{ "url": "webpack:///src/", "path": "${webRoot}/" }]
    }
  ]
}

vue.config.js vue.config.js

module.exports = {
  configureWebpack: {
    devtool: 'source-map'
  },
  productionSourceMap: false,
  css: {
    loaderOptions: {
      less: {
        javascriptEnabled: true
      }
    }
  }
};

There seems to be a lot of help available for debugging in chrome in contrast to Firefox.与 Firefox 相比,chrome 中的调试似乎有很多帮助。 Therefore it will be highly appreciated by many developers like me who want to keep Firefox as their primary browser.因此,许多像我这样想要将 Firefox 作为他们的主要浏览器的开发人员将高度赞赏它。

I suggest looking at this configuration:我建议看看这个配置:

    {
      "name": "Launch localhost",
        "type": "firefox",
        "request": "launch",
        "reAttach": true,
        "firefoxExecutable": "/usr/bin/firefox",
        "url": "http://localhost:8080/",
        "skipFiles": [
            "${workspaceFolder}/app/node_modules/**"
        ],
        "pathMappings": [
            {
                "url": "webpack:///",
                "path": "${workspaceFolder}/app/src/components/"
            }
        ]
    }

Source 资源

I get troubles when using the debug function of Visual Studio Code too.我在使用 Visual Studio Code 的调试 function 时也遇到了麻烦。 So I use debugger of Firefox instead, it works well, satisfies all of my needs.所以我改用 Firefox 的调试器,它运行良好,满足了我的所有需求。 I hope this answer may help you.我希望这个答案可以帮助你。

I debug my Vue.js code like this:我像这样调试我的 Vue.js 代码:

  1. Inside the file vue.config.js (you already did this):在文件 vue.config.js 中(你已经这样做了):

    module.exports = { configureWebpack: { devtool: 'source-map' }... }; module.exports = { configureWebpack: { devtool: 'source-map' }... };

  2. Run the Vue app in the command line using this statement: yarn serve使用以下语句在命令行中运行 Vue 应用程序:yarn serve

  3. In Firefox, open Debugger tab inside Developer tools, find the src file.vue you want to debug inside the folder Webpack there, then set breakpoints to debug.在Firefox中,打开Developer tools里面的Debugger选项卡,在Webpack文件夹里面找到你要调试的src file.vue,然后设置断点调试。 (if you don't know where to look up the src file, you can look at my screen here: example screen (如果您不知道在哪里查找 src 文件,可以在这里查看我的屏幕:示例屏幕

just open browser, and run your project and open you developer tools, and mark point there.只需打开浏览器,运行您的项目并打开您的开发人员工具,然后在此处标记。 you can do essay way.你可以做论文的方式。

here is documentation这是文档

https://firefox-source-docs.mozilla.org/devtools-user/debugger/ https://firefox-source-docs.mozilla.org/devtools-user/debugger/

Browser devtools extension for debugging Vue.js applications.用于调试 Vue.js 应用程序的浏览器 devtools 扩展。 https://github.com/vuejs/vue-devtools https://github.com/vuejs/vue-devtools

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM