{"id":22227,"library":"rollup-plugin-sourcemaps","title":"rollup-plugin-sourcemaps","description":"Rollup plugin that loads existing source maps from sourceMappingURL comments in JavaScript files. Version 0.6.3 is the latest stable, with infrequent releases. It works with Rollup >=0.31.2 and helps preserve source maps from transpiled files or external modules before final bundling. Unlike Babel's inputSourceMap option, this plugin works with any source map source, making it useful when consuming pre-compiled dependencies or when using multiple transpilation steps.","status":"active","version":"0.6.3","language":"javascript","source_language":"en","source_url":"https://github.com/maxdavidson/rollup-plugin-sourcemaps","tags":["javascript","rollup","rollup-plugin","sourcemap","source-map","sourceMappingURL","typescript"],"install":[{"cmd":"npm install rollup-plugin-sourcemaps","lang":"bash","label":"npm"},{"cmd":"yarn add rollup-plugin-sourcemaps","lang":"bash","label":"yarn"},{"cmd":"pnpm add rollup-plugin-sourcemaps","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency; plugin is designed to work as a Rollup plugin","package":"rollup","optional":false}],"imports":[{"note":"Default export; also works with require in CommonJS","wrong":"const sourcemaps = require('rollup-plugin-sourcemaps')","symbol":"sourcemaps","correct":"import sourcemaps from 'rollup-plugin-sourcemaps'"}],"quickstart":{"code":"import sourcemaps from 'rollup-plugin-sourcemaps';\nimport { rollup } from 'rollup';\n\nconst bundle = await rollup({\n  input: 'src/index.js',\n  plugins: [sourcemaps()],\n  output: {\n    sourcemap: true,\n    file: 'dist/bundle.js',\n    format: 'esm'\n  }\n});\n\nawait bundle.write({\n  sourcemap: true,\n  file: 'dist/bundle.js',\n  format: 'esm'\n});","lang":"javascript","description":"Sets up Rollup with the sourcemaps plugin to include existing source maps in the final bundle."},"warnings":[{"fix":"Update to latest rollup-plugin-sourcemaps and Rollup 3","message":"Rollup 3 dropped support for some plugin hooks; ensure compatibility with this plugin version","severity":"breaking","affected_versions":">=0.0.0"},{"fix":"Ensure your input files have external source map references (e.g., //# sourceMappingURL=file.js.map)","message":"Plugin only works with files that have a sourceMappingURL comment; inline source maps are not supported","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Add sourcemap: true to output options in rollup.config.js","message":"Output must have sourcemap:true for the plugin to take effect","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Migrate to Rollup's native source map support or use @rollup/plugin-sourcemaps if available","message":"This plugin is in maintenance mode; consider using Rollup's built-in source map handling or plugin hooks","severity":"deprecated","affected_versions":">=0.0.0"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"npm install --save-dev rollup-plugin-sourcemaps","cause":"Package not installed","error":"Error: Cannot find module 'rollup-plugin-sourcemaps'"},{"fix":"Use 'import sourcemaps from \"rollup-plugin-sourcemaps\"' and call sourcemaps()","cause":"Wrong import style (e.g., using named import instead of default)","error":"TypeError: sourcemaps is not a function"},{"fix":"Add sourcemap: true to Rollup output config","cause":"Output sourcemap option not set","error":"Error: You must specify output.sourcemap: true to use this plugin"},{"fix":"Ensure the referenced .map file exists or fix the path","cause":"Missing source map file or wrong path in sourceMappingURL","error":"Error: Could not resolve source map for '...'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}