How to use VS Code debugger with webpack-dev-server (breakpoints ignored)

后端 未结 4 1037
花落未央
花落未央 2021-01-31 03:03

My problem is simple.

I just want to make VS Code\'s debugger work with webpack-dev-server without ignoring my breakpoints.

Now, webpack-dev-server serves the bund

4条回答
  •  夕颜
    夕颜 (楼主)
    2021-01-31 03:16

    From my experience (about 15 mins ago), if 'webpack.config.js' has a value for the context property, then that has to be accounted for for '.vscode/launch.json'.

    For an example, if 'webpack.config.js' has the following:

    module.exports = {
      context: path.resolve(__dirname, 'src'),
      entry: './index.ts',
    

    Then launch.json needs that context ('src') too:

    "url": "http://localhost:8080/",
    "webRoot": "${workspaceRoot}/src",
    "sourceMaps": true,
    

    I just updated/fixed my repo so now TypeScript breakpoints should bind.

    https://github.com/marckassay/VSCodeNewProject

    I hope that helps.

提交回复
热议问题