@tracewayapp/bundler-plugin
v1.2.0
Published
Vite, Rollup and webpack plugins that inject ECMA-426 debug IDs into bundles and source maps for Traceway symbolication
Readme
Traceway Bundler Plugin
Vite, Rollup, and webpack plugins that inject ECMA-426 debug IDs into your bundles and source maps. A debug ID ties a deployed bundle to the exact source map produced by the same build, so Traceway symbolicates production stack traces against the right map regardless of filenames, CDNs, or concurrent deploys.
Traceway is a completely open-source error tracking platform. You can self-host it or use Traceway Cloud.
What It Does
For every emitted JS chunk, the plugin:
- Derives a deterministic debug ID from the chunk's content (SHA-256, formatted as a UUID)
- Injects a tiny runtime snippet that registers the ID in a
_tracewayDebugIdsglobal, so the Traceway SDK can report which bundles were involved in an exception - Appends the spec's
//# debugId=<uuid>comment to the chunk - Writes the
debugIdfield into the source map JSON (plusdebug_idfor Sentry-tooling compatibility)
The format follows the ECMA-426 Debug ID proposal (the same convention used by Sentry, Rollup's output.sourcemapDebugIds, and Bun), so artifacts stay interoperable across tooling.
Installation
npm install -D @tracewayapp/bundler-pluginVite
// vite.config.ts
import { defineConfig } from "vite";
import { tracewayDebugIds } from "@tracewayapp/bundler-plugin/vite";
export default defineConfig({
build: {
sourcemap: true,
},
plugins: [tracewayDebugIds()],
});Rollup
// rollup.config.js
import { tracewayDebugIds } from "@tracewayapp/bundler-plugin/rollup";
export default {
output: {
sourcemap: true,
},
plugins: [tracewayDebugIds()],
};webpack (5+)
// webpack.config.js
const {
TracewayDebugIdsWebpackPlugin,
} = require("@tracewayapp/bundler-plugin/webpack");
module.exports = {
devtool: "source-map",
plugins: [new TracewayDebugIdsWebpackPlugin()],
};Uploading
Upload your build output with @tracewayapp/sourcemap-upload as usual; the Traceway backend detects debug IDs in the uploaded files automatically and indexes the artifacts by ID. Frames without a debug ID (or uploads from builds without this plugin) keep resolving by filename.
npx @tracewayapp/sourcemap-upload \
--url https://traceway.example.com \
--token YOUR_SOURCE_MAP_TOKEN \
--directory dist/assetsNode Bundles
The injected snippet detects window, globalThis, global, and self, so it works in bundled Node services the same way it does in browsers.
