Rollup plugin (v0.7.0) that loads existing source maps from sourceMappingURL comments in transpiled files. Designed for workflows where files are pre-transpiled (e.g., with Babel or TypeScript) before bundling, or when consuming external modules that include inline source maps. It automatically reads and attaches source maps so Rollup's output contains accurate mappings. Lightweight alternative to webpack's source-map-loader, with no extra configuration needed. Works with Rollup >=0.31.2 and Node >=10.0.0. Ships TypeScript declarations. Last updated 2021, stable release.
npm install rollup-plugin-include-sourcemapsVerified import paths — ran on the pinned version, not inferred.
Shows minimal Rollup config using the plugin to include existing source maps from transpiled input files.
Order plugins: sourcemaps() first, then other transforms.
Set output.sourcemap to true or 'inline'.
Use Rollup's output.sourcemap or plugins like @rollup/plugin-sourcemaps if needed.
Use 'includeFile' and 'excludeFile' instead of 'include' and 'exclude'.
Run `npm install rollup-plugin-include-sourcemaps` and ensure the import statement uses default import (no curly braces).
Change to `import sourcemaps from 'rollup-plugin-include-sourcemaps'`.
Ensure the input file has a valid sourceMappingURL comment (inline or reference) and the source map file exists adjacent to the source.