Registry / devops / rollup-sourcemap-path-transform

rollup-sourcemap-path-transform

JSON →
library1.2.0jsnpmunverified

A Rollup utility that provides a sourcemapPathTransform function to rebase source map file paths, allowing grouping of sources under a common prefix in browser debuggers. Current stable version is 1.2.0, with a release cadence of about once a year. Supports Rollup 2, 3, and 4. Differentiators: supports multiple prefix replacements with optional wildcard matching and strict mode that throws on unmapped paths.

npm install rollup-sourcemap-path-transform
INSTALL
IMPORT
SIG · ROLLUP-SOURCEMAP-P
R
rollup-sourcemap-path-transform
devopsjavascriptv1.2.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

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

createPathTransform
import { createPathTransform } from 'rollup-sourcemap-path-transform'
ESM-only package; CommonJS require will not work.
createPathTransform
import { createPathTransform } from 'rollup-sourcemap-path-transform'
const createPathTransform = require('rollup-sourcemap-path-transform')
default import
import { createPathTransform } from 'rollup-sourcemap-path-transform'
import createPathTransform from 'rollup-sourcemap-path-transform'
Package has no default export; only named export.

Configures Rollup to rebase source map paths under /myproj/ prefix.

import { createPathTransform } from 'rollup-sourcemap-path-transform' export default { input: 'src/index.js', output: { file: 'dist/index.js', sourcemap: true, sourcemapPathTransform: createPathTransform({ prefixes: { '*src/': '/myproj/' } }) } }
Debug
Known issues
breakingPackage is ESM only; using require() will cause a runtime error.
fix
Switch to import syntax or use dynamic import().
affects: >=1.0
gotchaPrefix must include trailing slash if you want to match directory boundaries; '*src' without slash will match 'src/foo' and 'src-bar'.
fix
Use '*src/' to match only paths starting with 'src/' or containing that segment.
affects: >=1.0
gotchaPrefixes are matched in declared order; the first match wins. Keep more specific prefixes first.
fix
Order prefixes from most specific to least specific.
affects: >=1.0
gotchaWith requirePrefix: true, any unmapped source path will throw an error. Rollup may crash if not all sources are covered.
fix
Ensure all source paths are covered by at least one prefix, or use false to ignore unmapped ones.
affects: >=1.0
Errors
Common errors & fixes
Error [ERR_MODULE_NOT_FOUND]: Cannot find module 'rollup-sourcemap-path-transform'
Using require() with an ESM-only package.
fix
Change to import statement: import { createPathTransform } from 'rollup-sourcemap-path-transform'
TypeError: createPathTransform is not a function
Default import attempted instead of named import.
fix
Use named import: import { createPathTransform } from 'rollup-sourcemap-path-transform'
Upgrade
Version history
1.2.0latest on npm
Audit
Dependencies
rolluprequiredPeer dependency - required to use the sourcemapPathTransform option.
Agent activity
4 hits · last 30 days
node
4
Resources
rollup-sourcemap-path-transform — npm install rollup-sourcemap-path-transform · libregistry