{"id":18460,"library":"karma-sourcemap-loader","title":"karma-sourcemap-loader","description":"A Karma plugin preprocessor that loads existing JavaScript source map files (both inline and external) into the Karma test runner. Version 0.4.0 is current stable. Unlike karma-sourcemap-preprocessor, this plugin does not generate source maps but locates them from previous build steps (e.g., TypeScript, Babel, webpack). It supports remapping source paths via prefix replacement or custom callback, and modifying sourceRoot. Inline source maps using base64 are also supported. Release cadence is low, primarily maintenance updates. Key differentiator: solves source map loading when compilation happens outside Karma.","status":"active","version":"0.4.0","language":"javascript","source_language":"en","source_url":"ssh://git@github.com/demerzel3/karma-sourcemap-loader","tags":["javascript","karma-plugin","karma-preprocessor","source-maps"],"install":[{"cmd":"npm install karma-sourcemap-loader","lang":"bash","label":"npm"},{"cmd":"yarn add karma-sourcemap-loader","lang":"bash","label":"yarn"},{"cmd":"pnpm add karma-sourcemap-loader","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Used for filesystem operations to load source map files","package":"graceful-fs","optional":false}],"imports":[{"note":"The preprocessor name is 'sourcemap', not the package name.","wrong":"preprocessors: { '**/*.js': ['karma-sourcemap-loader'] }","symbol":"sourcemap","correct":"preprocessors: { '**/*.js': ['sourcemap'] }"},{"note":"Configuration key must use camelCase: sourceMapLoader (capital M) in karma.conf.js.","wrong":"config.set({ sourcemapLoader: { ... } })","symbol":"sourceMapLoader","correct":"config.set({ sourceMapLoader: { ... } })"},{"note":"The exact key is 'remapPrefixes', not 'remap' or 'prefixes'.","wrong":"sourceMapLoader: { remap: { '/myproject/': '../src/' } }","symbol":"remapPrefixes","correct":"sourceMapLoader: { remapPrefixes: { '/myproject/': '../src/' } }"}],"quickstart":{"code":"// karma.conf.js\nmodule.exports = function(config) {\n  config.set({\n    basePath: '',\n    frameworks: ['jasmine'],\n    files: ['src/**/*.js', 'test/**/*.spec.js'],\n    preprocessors: {\n      '**/*.js': ['sourcemap']\n    },\n    sourceMapLoader: {\n      remapPrefixes: {\n        '/myproject/': '../src/'\n      }\n    },\n    browsers: ['ChromeHeadless'],\n    singleRun: true\n  });\n};","lang":"javascript","description":"Configures Karma to load existing source maps for all JS files, remapping paths with a prefix."},"warnings":[{"fix":"Use 'sourcemap' as the preprocessor name in preprocessors config.","message":"Preprocessor name is 'sourcemap' not 'karma-sourcemap-loader'.","severity":"gotcha","affected_versions":">=0.2.0"},{"fix":"Use 'sourceMapLoader' in config.set().","message":"Configuration key is 'sourceMapLoader' (camelCase) not 'sourcemaploader' or 'source-map-loader'.","severity":"gotcha","affected_versions":">=0.3.0"},{"fix":"Upgrade Node.js to version 10 or later.","message":"Removed Node.js < 10 support. Graceful-fs usage may break on older Node.","severity":"breaking","affected_versions":">=0.4.0"},{"fix":"Use 'remapPrefixes' object instead of 'remapSource' function if possible.","message":"The 'remapSource' callback function may be deprecated in future versions; prefer 'remapPrefixes'.","severity":"deprecated","affected_versions":">=0.4.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Ensure preprocessors config uses 'sourcemap' exactly, e.g., preprocessors: { '**/*.js': ['sourcemap'] }.","cause":"Preprocessor name 'sourcemap' is misspelled or not configured correctly.","error":"Error: No provider for \"sourcemap\"! (Resolving: sourcemap)"},{"fix":"Rename file to .cjs or use export default or dynamic import() for ES modules.","cause":"Using CommonJS module.exports in an ESM project (package.json type: module).","error":"ReferenceError: module is not defined in ES module scope"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}