1. 程式人生 > >vscode中除錯webpack構建的專案

vscode中除錯webpack構建的專案

在webpack的配置中:

	devtool: 'source-map',
	output: {
		publicPath: '/',
		devtoolModuleFilenameTemplate: '../[resource-path]'
	},

launch.json中配置

{
    "version": "0.2.0",
    "configurations": [
      {
        "type": "chrome",
        "request": "launch",
        "name": "wepack中除錯",
        "url": "http://localhost:3060",
        "webRoot": "${workspaceFolder}/src",
        "breakOnLoad": true,
        "sourceMapPathOverrides": {
          "webpack:///src/*": "${webRoot}/*"
        }
      }
    ]
}