@codeserk/forge-stats-vite
v0.7.0
Published
Vite plugin for Forge Stats. Uploads the source maps of the build, so errors show the original code.
Maintainers
Readme
@codeserk/forge-stats-vite
Vite plugin for @codeserk/forge-stats. Builds with hidden source maps, uploads them in the compact format to the public API after the build and deletes them from the output, so they are never deployed. Errors are then resolved to the original code. A failed upload only warns, the build passes.
Installation
npm install --save-dev @codeserk/forge-stats-viteUsage
The SDK key comes from the env var tokenEnv names. Use the key of a CI client with the upload-sourcemaps permission, never the one the app ships, and do not prefix the var with VITE_, so it stays out of the bundle:
import { defineConfig } from 'vite'
import { forgeStats } from '@codeserk/forge-stats-vite'
export default defineConfig({
plugins: [forgeStats({ appVersion: process.env.APP_VERSION!, tokenEnv: 'FORGE_STATS_CI_SDK' })],
})Use the same appVersion in init, so errors are resolved with the source maps of their build.
| Option | Type | Description |
| ------------ | -------- | ---------------------------------------------------------------------------- |
| appVersion | string | Version of the build |
| tokenEnv | string | Name of the env var with the SDK key of the CI client |
| baseUrl | string | Optional. Base URL of the public API. Defaults to https://api.forge.codeserk.es |
