Skip to main content

Component names

Beta

This page documents the Bugsee JavaScript SDK, which is in beta (0.1.x) and can change between betas.

Minification renames your components, so a click or an error that happens inside UserCard can end up attributed to something like t or e. The component name plugins fix that at build time. They label the DOM elements a component renders with the component's name, in a data-bugsee-component attribute. Bugsee reads that attribute in the browser to attribute clicks and errors to the component, even in a minified build.

The plugins are optional and have nothing to do with source maps. Without them, everything is still captured and your stack traces are still readable once you upload source maps. They only add the component name.

FrameworkHowPackage
React, Preact, SolidA Babel plugin with no options. Needs @babel/core 7.@bugsee/babel-plugin-component-annotate
Svelte, SvelteKitA Svelte preprocessor. Needs svelte 4 or newer.@bugsee/svelte-plugin-component-annotate
VueA runtime mixin, not a build plugin.Included in @bugsee/vue

React, Preact and Solid​

Install the plugin as a development dependency:

npm install --save-dev @bugsee/babel-plugin-component-annotate

Add it to your Babel configuration:

babel.config.cjs
module.exports = {
plugins: [['@bugsee/babel-plugin-component-annotate']],
};

The plugin adds data-bugsee-component="<ComponentName>" to each host element, such as a <button> or <div>, that a PascalCase function or class component renders. It does not annotate component elements.

If you build with Vite and @vitejs/plugin-react, pass the plugin through that plugin's Babel option. For Solid, use vite-plugin-solid's Babel option.

Svelte and SvelteKit​

Install the preprocessor as a development dependency:

npm install --save-dev @bugsee/svelte-plugin-component-annotate

Add it to the preprocess list in svelte.config.js:

svelte.config.js
import { componentAnnotatePreprocessor } from '@bugsee/svelte-plugin-component-annotate';

export default {
preprocess: [componentAnnotatePreprocessor()],
};

On SvelteKit 3 there is no svelte.config.js. Pass preprocess to the sveltekit() Vite plugin instead:

vite.config.ts
import { componentAnnotatePreprocessor } from '@bugsee/svelte-plugin-component-annotate';
import { sveltekit } from '@sveltejs/kit/vite';

export default {
plugins: [sveltekit({ preprocess: [componentAnnotatePreprocessor()] })],
};

The name comes from the file name, so UserCard.svelte becomes UserCard. For index.svelte and SvelteKit route files, the folder name is used.

OptionTypeDefaultDescription
renderSpansbooleanfalseAlso record a render span for each component's initialization in your performance data. Needs @bugsee/svelte.

Vue​

Vue does not need a build plugin. Register the component mixin that @bugsee/vue provides; see Vue.

Found an issue, typo, or wrong statement on this page? Report it now →