vscode debugger for chrome 调试webpack的配置问题

module.exports = {
  entry: './app.ts',
  output: {
    filename: 'bundle.js',
    publicPath: '/assets',
    devtoolModuleFilenameTemplate: '../[resource-path]'
  },
  resolve: {
    // Add `.ts` and `.tsx` as a resolvable extension.
    extensions: ['.webpack.js', '.web.js', '.ts', '.tsx', '.js']
  },
  devtool: 'source-map',
  devServer: {
  },
  module: {
    loaders: [
      // all files with a `.ts` or `.tsx` extension will be handled by `ts-loader`
      { test: /.tsx?$/, loader: 'ts-loader!source-map-loader' },
      { test: /.html$/, loader: 'raw-loader'                  }
    ]
  }
}


VSCODE 配置launch.json文件
{
    // 使用 IntelliSense 了解相关属性。
    // 悬停以查看现有属性的描述。
    // 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387
    "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}/*"
        }
    }]
}

重点是:devtoolModuleFilenameTemplate这个配置项
原文地址:https://www.cnblogs.com/zzsdream/p/10061017.html