Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a command line flag to disable JavaScript source maps for Chrome?

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?

like image 863
stealththeninja Avatar asked May 03 '17 04:05

stealththeninja


People also ask

How do I turn off source maps in Chrome?

Open Developer Tools, go to "Settings" for Developer Tools, then uncheck Enable JavaScript Sourcemaps under the "Sources" settings.

How do I add a command line flag to Chrome?

Right click on your "Chrome" shortcut. Choose properties. At the end of your "Target:" line add the command line flags.

What happens if you disable JavaScript in Chrome?

It blocks several elements on websites that include tracking cookies, thus enhancing your privacy. Disabling JavaScript can break websites too, affecting the user experience. It eliminates the possibility of a hacker injecting malicious code into the web page you browse.


1 Answers

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
like image 174
mooga Avatar answered Oct 19 '22 14:10

mooga