SolidJS + Sentry
Error monitoring and tracing with Sentry; off until you set a DSN. This page shows exactly what pickstack adds to a SolidJS project for Sentry: the packages, the new files and the changes to existing ones. Every combination is installed, built, linted and tested in CI.
$ npm create pickstack@latest my-app -- --framework solid --modules sentry --yesCustomize in the configurator
Packages it adds
| Package | Version | Type |
|---|---|---|
@sentry/solid | ^11.19.0 | runtime |
New files
VITE_SENTRY_DSN=
import * as Sentry from "@sentry/solid";
/** Sends errors and traces to Sentry; stays off until the DSN is set (see .env.example). */
export function initSentry() {
const dsn = import.meta.env.VITE_SENTRY_DSN;
if (!dsn) return;
Sentry.init({
dsn,
integrations: [Sentry.browserTracingIntegration()],
// Traces 10% of page loads; raise it while trying things out.
tracesSampleRate: 0.1,
});
}
Changes to existing files
/* @refresh reload */ import { render } from "solid-js/web"; import App from "./App";+import { initSentry } from "./sentry"; import "./index.css"; +initSentry();+ const root = document.getElementById("root"); render(() => <App />, root!);⋯ 1 unchanged lines
Project files
.env.example.gitignoreREADME.mdindex.htmlpackage.jsonsrc/App.tsxsrc/components/Counter.tsxsrc/index.csssrc/index.tsxsrc/sentry.tstsconfig.app.jsontsconfig.jsontsconfig.node.jsonvite.config.ts