20

Edit: I opened a new issue with Chromium.


Our project uses TypeScript compiled to JavaScript. When debugging automated unit tests in Karma, I want to disable JavaScript source maps and stick to debugging the compiled code.

I know how to do this from the browser settings but the change expires when I close the browser, so I'm looking for a way to disable it programmatically.

Disable source maps in Chrome DevTools

Chrome accepts other flags from the command line (e.g. --no-sandbox). Is there a flag or similar means to disable source maps?

stealththeninja
  • 3,576
  • 1
  • 26
  • 44
  • Based on the Chromium flags list https://peter.sh/experiments/chromium-command-line-switches/ it seems there isn't any flags to disable the JavaScript Source map files :( – ZedTuX Mar 16 '18 at 09:47
  • Here is an open issue requesting exactly what we are looking for: https://bugs.chromium.org/p/chromium/issues/detail?id=534874 – ZedTuX Mar 16 '18 at 09:52
  • The list of command line switches linked above contains a flag called `--devtools-flags` "Passes command line parameters to the DevTools front-end" Maybe this is used in combination with some other flag? – givanse Feb 04 '19 at 22:27
  • There is a workaround in the reported issue https://bugs.chromium.org/p/chromium/issues/detail?id=781648#c4 – lalo Feb 12 '19 at 17:39
  • For now, try disabling creation of source maps from your bundler? – Aravind Voggu Feb 12 '19 at 19:48
  • found this link to help you https://stackoverflow.com/questions/35002087/disable-source-maps-in-chrome-devtools – user46194 Feb 20 '19 at 06:24
  • @user46194 the link is already in the question. – stealththeninja Feb 20 '19 at 06:26

1 Answers1

1

on webpack.config.js

add devtool: false

exports.onCreateWebpackConfig = ({ actions, stage }) => {
  // If production JavaScript and CSS build
  if (stage === 'build-javascript') {
    // Turn off source maps
    actions.setWebpackConfig({
      devtool: false,
    })
  }
};

or

You can pass compiler options inside every loader query string

loadWhatEVer?sourceMap=false
mooga
  • 3,136
  • 4
  • 23
  • 38