Files
react-native-devtools-frontend/node_modules/karma-sourcemap-loader
Tim van der Lippe 8fa65441f9 Add filesystem TypeScript types
We use these types for all of our interactions with the local filesystem
API's and they don't normally ship with TypeScript library definitions.

R=jacktfranklin@chromium.org
DISABLE_THIRD_PARTY_CHECK=Add node_module

Bug: 1011811
Change-Id: I41ae8faf8cce289c86a6795ff76d8a10b5b3609d
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2108760
Auto-Submit: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
2020-03-18 17:58:39 +00:00
..
2020-03-18 17:58:39 +00:00

karma-sourcemap-loader

Preprocessor that locates and loads existing source maps.

Why

When you use karma not in isolation but as part of a build process (e.g. using grunt or gulp) it is often the case that the compilation/transpilation is done on a previous step of the process and not handled by karma preprocessors. In these cases source maps don't get loaded by karma and you lose the advantages of having them.

How it works

This plug-in supports both inline and external source maps.

Inline source maps are located by searching "sourceMappingURL=" inside the javascript file, both plain text and base64-encoded maps are supported.

External source maps are located by appending ".map" to the javascript file name. So if for example you have Hello.js, the preprocessor will try to load source map from Hello.js.map.

Installation

Just write karma-sourcemap-loader as a devDependency in your package.json.

{
  "devDependencies": {
    "karma-sourcemap-loader": "~0.2"
  }
}

Or just issue the following command:

npm install karma-sourcemap-loader --save-dev

Configuration

The code below shows a sample configuration of the preprocessor.

// karma.conf.js
module.exports = function(config) {
  config.set({
    preprocessors: {
      '**/*.js': ['sourcemap']
    }
  });
};

Credits

Thanks to @goldibex for adding inline source maps support.