@faststats/sourcemap-uploader-plugin
v0.4.0
Published
> [!IMPORTANT] > This repository is in early development and not intended for production use. > Its only published for internal testing.
Readme
@faststats/sourcemap-uploader-plugin
[!IMPORTANT] This repository is in early development and not intended for production use. Its only published for internal testing.
Unplugin-based sourcemap uploader that works across all unplugin adapters:
- Vite
- Rollup
- Rolldown
- Webpack
- Rspack
- esbuild
- Unloader
- Farm
- Bun
What it does
- injects build metadata in the bundle at
globalThis.__SOURCEMAPS_BUILD__ - uploads generated sourcemaps to a backend endpoint
- supports custom
buildIdor auto-generated IDs - prefers native bundler build IDs when available (webpack/rspack compilation hash)
- optionally deletes sourcemap files after successful upload
Usage
import sourcemapsPlugin from "@sourcemaps/bundler-plugin/vite";
export default {
plugins: [
sourcemapsPlugin({
endpoint: "http://localhost:3000/v0/upload",
deleteAfterUpload: true,
}),
],
};Options
endpoint(required): upload URLenabled:trueby default; setfalseor pass(framework) => booleanto disable the plugin conditionallyauthToken: bearer token for the upload requestbuildId: custom build identifierdeleteAfterUpload: remove sourcemap files after successful uploadglobalKey: runtime global key for build metadatafetchImpl: custom fetch implementationonUploadSuccess: callback after successful uploadonUploadError: callback when upload fails
Upload payload
The plugin sends POST /v0/upload with this JSON body:
{
"type": "javascript",
"buildId": "build-123",
"uploadedAt": "2026-04-01T12:00:00.000Z",
"files": [
{
"fileName": "assets/app.js.map",
"content": "{...}"
}
]
}Tests
bun test