question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Debugging in VSCode

See original GitHub issue

I’m trying to setup remote debugging in VSCode for my storybook components. However, when i launch storybook using the Chrome Remote Debugging plugin in VSCode it says that is cannot find my source. I’m assuming this has to do with the iFrame window that the actual stories run inside of.

Has anyone successfulyl setup remote debugging in VSCode for Storybook stories? Is there a launch.json config to be shared?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:13
  • Comments:20 (8 by maintainers)

github_iconTop GitHub Comments

10reactions
kreslicommented, Aug 25, 2018

This shouldn’t be closed until the docs are updated. Also still no luck with above configuration. However adding * in sourceMapPathOverriders works for me

      "type": "chrome",
      "request": "launch",
      "name": "Storybook Debug",
      "url": "http://localhost:6006",
      "sourceMaps": true,
      "webRoot": "${workspaceFolder}",
      "sourceMapPathOverrides": {
        "webpack:///*": "${webRoot}/*",
        "webpack:///./*": "${webRoot}/*",
        "webpack:///src/*": "${webRoot}/*",
        "webpack:///./~/*": "${webRoot}/node_modules/*"
      }
    },```
2reactions
stephencweisscommented, Dec 5, 2019

@ryudice - I got it working this morning after a bit of investigation.

I used @kresli’s solution, though ran into the same issue where my breakpoints weren’t stopping.

Turns out this is a known issue: https://github.com/Microsoft/vscode-chrome-debug#my-breakpoints-arent-hit-whats-wrong

For me, the issue was a simple as refreshing the Storybook page, though a better fix was to add the breakOnLoad option. With that addition to @kresli’s solution, no reload was necessary. .

My launch.json:

    {
      // Requires the extension Debugger for Chrome: https://marketplace.visualstudio.com/items?itemName=msjsdiag.debugger-for-chrome
      "type": "chrome",
      "request": "launch",
      "name": "Storybook Debug",
      "breakOnLoad": true,
      "url": "http://localhost:9001",
      "sourceMaps": true,
      "webRoot": "${workspaceFolder}",
      "sourceMapPathOverrides": {
        "webpack:///*": "${webRoot}/*",
        "webpack:///./*": "${webRoot}/*",
        "webpack:///src/*": "${webRoot}/*",
        "webpack:///./~/*": "${webRoot}/node_modules/*"
      }
    },

The other thing to keep in mind (in case it’s not immediately obvious) is that the url should match where your Storybook server is running.

The launch.json config matches my Storybook script:

"scripts": {
  "storybook": "start-storybook -p 9001 -c .storybook",
}

Hope this helps you or anyone else who comes later!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Debugging in Visual Studio Code
To run or debug a simple app in VS Code, select Run and Debug on the Debug start view or press F5 and...
Read more >
Introduction to Debugging in Visual Studio Code
Debugging is a core feature of Visual Studio Code. In this tutorial, we will show you how to run and debug a program...
Read more >
Debug Browser Apps using Visual Studio Code
The simplest way to debug a webpage is through the Debug: Open Link command found in the Command Palette (Ctrl+Shift+P). When you run...
Read more >
Debugger Extension - Visual Studio Code
Visual Studio Code's debugging architecture allows extension authors to easily integrate existing debuggers into VS Code, while having a common user interface ...
Read more >
Debugging - vscode-docs
To bring up the Debug view, click on the Debugging icon in the View Bar on the side of VS Code. ... The...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found