Skip to content

Instantly share code, notes, and snippets.

@anver
Forked from jarshwah/launch.json
Created February 21, 2021 17:17
Show Gist options
  • Save anver/e4310ff215b8a104b4e730e2c81ca35c to your computer and use it in GitHub Desktop.
Save anver/e4310ff215b8a104b4e730e2c81ca35c to your computer and use it in GitHub Desktop.

Revisions

  1. @jarshwah jarshwah created this gist Apr 23, 2017.
    24 changes: 24 additions & 0 deletions launch.json
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,24 @@
    // debug config for running project under vscode debugger
    {
    "version": "0.2.0",
    "configurations": [
    {
    "trace": true,
    "name": "Chrome Debug",
    "type": "chrome",
    "request": "launch",
    "url": "http://localhost:8000/",
    "webRoot": "${workspaceRoot}/src/", // folder containing webpack.config.js
    "userDataDir": "${workspaceRoot}/.vscode/chrome",
    "sourceMaps": true,
    "disableNetworkCache": true,
    // we have multiple js source folders, so some source maps are still generated with webpack protocol links. Don't know why?
    "sourceMapPathOverrides": { // if you override this, you MUST provide all defaults again
    "webpack:///./~/*": "${webRoot}/node_modules/*", // a default
    "webpack:///./*": "${webRoot}/js-src/*", // unsure how/why webpack generates ./links.js
    "webpack:///../*": "${webRoot}/js-src/*", // unsure how/why webpack generates ../links.js
    "webpack:///*": "*" // a default, catch everything else
    }
    }
    ]
    }
    16 changes: 16 additions & 0 deletions webpack.config.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,16 @@
    // source: ./js-src/<item>
    // target: ./static/js-build/<item>
    // Do not use uglify plugin when debugging, did not try to get source maps working with uglify

    {
    resolve: {
    root: [ // older webpack config
    path.join(__dirname, '/js-src'), // source at ./js-src/
    ]
    devtool: "source-map", // many options, but this one works best for me: https://webpack.js.org/configuration/devtool/
    output: {
    filename: '[name].js',
    path: path.join(__dirname, '/static/js-build'), // compile to ./static/js-build
    devtoolModuleFilenameTemplate: 'file:///[absolute-resource-path]' // map to source with absolute file path not webpack:// protocol
    }
    }