@1mn/vite-plugin
v0.1.2
Published
Vite plugin for 1mn — uploads hidden source maps at build time so client-side errors symbolicate to original source. Pairs with @1mn/react.
Downloads
808
Maintainers
Readme
@1mn/vite-plugin
Build-time source-map upload for 1mn. Pairs with
@1mn/react: client-side exceptions
captured by the SDK arrive symbolicated to your original source
([email protected]:42) instead of minified bundle coordinates
([email protected]:1:48213).
How it works
- Forces
build.sourcemap = "hidden"— Vite emits.mapfiles but omits the//# sourceMappingURLcomment, so maps are produced but not served publicly. - Injects
import.meta.env.VITE_1MN_RELEASEso you can tag the runtime SDK with the same release the maps are keyed by. - After the client build, uploads each
.mapto 1mn (authenticated by your public key) and deletes it locally.
Install
npm install -D @1mn/vite-pluginUsage
// vite.config.ts
import { defineConfig } from "vite";
import { onemnSourcemaps } from "@1mn/vite-plugin";
export default defineConfig({
plugins: [
onemnSourcemaps({
apiKey: "1mn_pk_…", // your product's public key
appUrl: "https://1mn.ai", // 1mn app origin (default)
// release: process.env.GIT_SHA, // optional; defaults to short git SHA
}),
],
});Then tag the SDK with the same release so events line up with the uploaded maps:
// wherever you render <OnemnProvider>
<OnemnProvider
apiKey="1mn_pk_…"
release={import.meta.env.VITE_1MN_RELEASE}
user={session?.user}
>
<App />
</OnemnProvider>That's it. Ship the build; the next client error in production will be symbolicated server-side.
Options
| Option | Default | Notes |
|---|---|---|
| apiKey | — | Required. Public key (1mn_pk_…). |
| release | env ONEMN_RELEASE → short git SHA → build-<ts> | Must match <OnemnProvider release>. Exposed as import.meta.env.VITE_1MN_RELEASE. |
| appUrl | https://1mn.ai | Upload endpoint is ${appUrl}/api/sdk/sourcemaps. |
| endpoint | — | Full endpoint override (wins over appUrl). |
| deleteAfterUpload | true | Remove .map files after a successful upload. |
| disabled | false | Skip upload entirely for a build. |
License
MIT
