Debug webpack bundled node ts with Visual Studio Code

前端 未结 1 1004
借酒劲吻你
借酒劲吻你 2020-12-28 11:35

(In some way related to this but more specific to VsCode)

I m trying to debug the AngularU starter kit with visual studio code. But it\'s

相关标签:
1条回答
  • 2020-12-28 12:25

    Here is how i make it work:

    1. Have VsCode atLeast 1.1.0 (older will struggle with sourceRoot)

    2. Set the bundle file the same name as its parent directory in webpack.config.js

      output: {
      path: path.join(__dirname, 'dist', 'server'),    
      filename: 'server.js'                         
      }, 
      
    3. and set the parent dir as 'outdir' in launch.json:

      ...
      "sourceMaps": true,
      "outDir": "${workspaceRoot}/dist/server",
      "smartStep":true
      
    4. Ask webpack to output absolute path for sourcemap in webpack.config.json

      output : {
      ...
      devtoolModuleFilenameTemplate        : '[absolute-resource-path]',
      devtoolFallbackModuleFilenameTemplate: '[absolute-resource-path]?[hash]'
      }
      
    0 讨论(0)
提交回复
热议问题