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?

7

1 Answer 1

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
1
  • Ah. Nice idea in general: don't serve source maps when running the tests.
    – Grant
    Jul 20, 2019 at 19:52

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.