Registry / devops / source-map-loader

source-map-loader

JSON →
library5.0.0jsnpmunverified

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.

npm install source-map-loader
INSTALL
IMPORT
SIG · SOURCE-MAP-LOADER
S
source-map-loader
devopsjavascriptv5.0.0
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

source-map-loader (default)
module.exports = { module: { rules: [{ test: /\.js$/, enforce: 'pre', use: ['source-map-loader'] }] } }
Used as a webpack loader in config, not imported in application code.
require('source-map-loader')
const sourceMapLoader = require('source-map-loader'); // not typical
import sourceMapLoader from 'source-map-loader'; // used in config, not runtime
Loader is referenced by name string in webpack config, not imported directly.
filterSourceMappingUrl option
options: { filterSourceMappingUrl: (url, resourcePath) => { ... } }
Function option for per-file source map URL handling.

Configures source-map-loader to process all JavaScript files before other loaders, extracting source maps. Includes ignoring parse warnings typical for third-party libraries.

// webpack.config.js module.exports = { module: { rules: [ { test: /\.js$/, enforce: 'pre', use: ['source-map-loader'], }, ], }, ignoreWarnings: [/Failed to parse source map/], }; // Then run webpack > npx webpack --mode development
Debug
Known issues
breakingMinimum Node.js version bumped to 18.12.0 in v5.0.0
fix
Upgrade Node.js to >=18.12.0
affects: >=5.0.0
breakingMinimum Node.js version bumped to 14.15.0 in v4.0.0
fix
Upgrade Node.js to >=14.15.0
affects: >=4.0.0 <5.0.0
breakingMinimum webpack version bumped to 5 in v2.0.0
fix
Upgrade webpack to >=5
affects: >=2.0.0
gotchaSource maps from node_modules are processed by default; can slow builds
fix
Use exclude: /node_modules/ in rule to avoid processing third-party maps if not needed
affects: >=0
deprecatedThe `source-map-js` package replaced `source-map` in v2.0.1 for performance
fix
No action needed; it's internal
affects: >=2.0.1
Errors
Common errors & fixes
Failed to parse source map from '...' Error: ENOENT: no such file or directory, open '...'
Linked source map URL points to a file that does not exist
fix
Ensure the source map file exists or use filterSourceMappingUrl to skip/remove the URL
WARNING in ./node_modules/... Module Warning (from ./node_modules/source-map-loader/dist/cjs.js): Failed to parse source map from '...' Error: data:...
Inline source map is malformed or uses unsupported encoding
fix
Update the library providing the source map or ignore warnings via ignoreWarnings config
Error: Cannot find module 'source-map-js'
Missing internal dependency (should be included but might be missing if manually installed incorrectly)
fix
Reinstall source-map-loader: npm install source-map-loader --save-dev
Upgrade
Version history
5.0.0latest on npm
Audit
Dependencies
webpackrequiredpeer dependency required at runtime; loader only works within webpack
Agent activity
9 hits · last 30 days
node
8
Resources
source-map-loader — npm install source-map-loader · libregistry