{"id":20561,"library":"source-map-loader","title":"source-map-loader","description":"Webpack loader that extracts inline and linked source maps from JavaScript files, including from node_modules, so webpack can process them for the generated bundle. Current stable version is 5.0.0 (2024-01-15), with major releases roughly yearly. Key differentiator: it ensures source map continuity across third-party libraries, preventing misinterpretation by browsers. Requires webpack 5+ and Node.js 18.12+ as of v5. Supports a filterSourceMappingUrl option to control per-file behavior.","status":"active","version":"5.0.0","language":"javascript","source_language":"en","source_url":"https://github.com/webpack-contrib/source-map-loader","tags":["javascript","webpack"],"install":[{"cmd":"npm install source-map-loader","lang":"bash","label":"npm"},{"cmd":"yarn add source-map-loader","lang":"bash","label":"yarn"},{"cmd":"pnpm add source-map-loader","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"peer dependency required at runtime; loader only works within webpack","package":"webpack","optional":false}],"imports":[{"note":"Used as a webpack loader in config, not imported in application code.","symbol":"source-map-loader (default)","correct":"module.exports = { module: { rules: [{ test: /\\.js$/, enforce: 'pre', use: ['source-map-loader'] }] } }"},{"note":"Loader is referenced by name string in webpack config, not imported directly.","wrong":"import sourceMapLoader from 'source-map-loader'; // used in config, not runtime","symbol":"require('source-map-loader')","correct":"const sourceMapLoader = require('source-map-loader'); // not typical"},{"note":"Function option for per-file source map URL handling.","symbol":"filterSourceMappingUrl option","correct":"options: { filterSourceMappingUrl: (url, resourcePath) => { ... } }"}],"quickstart":{"code":"// webpack.config.js\nmodule.exports = {\n  module: {\n    rules: [\n      {\n        test: /\\.js$/,\n        enforce: 'pre',\n        use: ['source-map-loader'],\n      },\n    ],\n  },\n  ignoreWarnings: [/Failed to parse source map/],\n};\n\n// Then run webpack\n> npx webpack --mode development","lang":"javascript","description":"Configures source-map-loader to process all JavaScript files before other loaders, extracting source maps. Includes ignoring parse warnings typical for third-party libraries."},"warnings":[{"fix":"Upgrade Node.js to >=18.12.0","message":"Minimum Node.js version bumped to 18.12.0 in v5.0.0","severity":"breaking","affected_versions":">=5.0.0"},{"fix":"Upgrade Node.js to >=14.15.0","message":"Minimum Node.js version bumped to 14.15.0 in v4.0.0","severity":"breaking","affected_versions":">=4.0.0 <5.0.0"},{"fix":"Upgrade webpack to >=5","message":"Minimum webpack version bumped to 5 in v2.0.0","severity":"breaking","affected_versions":">=2.0.0"},{"fix":"Use exclude: /node_modules/ in rule to avoid processing third-party maps if not needed","message":"Source maps from node_modules are processed by default; can slow builds","severity":"gotcha","affected_versions":">=0"},{"fix":"No action needed; it's internal","message":"The `source-map-js` package replaced `source-map` in v2.0.1 for performance","severity":"deprecated","affected_versions":">=2.0.1"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Ensure the source map file exists or use filterSourceMappingUrl to skip/remove the URL","cause":"Linked source map URL points to a file that does not exist","error":"Failed to parse source map from '...' Error: ENOENT: no such file or directory, open '...'"},{"fix":"Update the library providing the source map or ignore warnings via ignoreWarnings config","cause":"Inline source map is malformed or uses unsupported encoding","error":"WARNING in ./node_modules/... Module Warning (from ./node_modules/source-map-loader/dist/cjs.js): Failed to parse source map from '...' Error: data:..."},{"fix":"Reinstall source-map-loader: npm install source-map-loader --save-dev","cause":"Missing internal dependency (should be included but might be missing if manually installed incorrectly)","error":"Error: Cannot find module 'source-map-js'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}