admin管理员组

文章数量:1406943

I am trying to hit breakpoints in VS code when serving an SPA from an ASP.NET Core app.

The SPA is built with webpack and placed in the ${workspaceFolder}/build folder.

The content is then copied to the ASP.Net Core app's folder structure as laid out below.

The index file with a reference to the app.<hash>.js is in public wwwroot. The app.<hash>.js is in a protected (requires authorization) WebContent folder. I have tried to place app.<hash>.js.map in both wwwroot and WebContent folders.

This is the current state of my launch configuration in VS code launch.json:

 {
        "type": "chrome",
        "name": "Launch Chrome against WebService",
        "sourceMaps": true,
        "request": "launch",
        "url": "http://127.0.0.1:5080",
        "webRoot": "${workspaceFolder}/build/WebContent",
        "resolveSourceMapLocations": [
           "${workspaceFolder}/build/WebContent/**",
           "!http://127.0.0.1:5080/**"
        ],
       "sourceMapPathOverrides": {
       "http://127.0.0.1:5080/WebContent/app.*.js": "${workspaceFolder}/build/WebContent/app.*.js.map",            
    }
 }

I have tried multiple variations of this launch config to make my breakpoints bind, but either the app.<hash>.js or app.<hash>.js.map is loaded into VS code debugging but never both of them.

So how do load both app.<hash>.js and app.<hash>.js.map from a running ASP.NET Core app into a VS Code debugging session so my breakpoints can bind?

On a side note: Chrome loads the sourcemap, and it works, so it's not an issue with the sourcemap.

本文标签: How to make VS code load sourcemaps from an ASPNET Core appStack Overflow