@faststats/sourcemap-uploader-plugin
v0.3.1
Published
> [!IMPORTANT] > This repository is in early development and not intended for production use. > Its only published for internal testing.
Downloads
654
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/api/sourcemaps",
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
Tests
bun test