Skip to content

Install an JavaScript SDK during sentry:publish #646

@cleptric

Description

@cleptric

Laravel offers two starter kits, Breeze and Jetstream with optionally bootstrap an application with JavaScript frameworks like Vue.js or React (with Interia.js) or Livewire.

  • When installing the Laravel SDK, prompt the user if they also want to install an JavaScript SDK to report frontend errors to Sentry
  • Update their package.json, and run npm/yarn/pnpm install
  • Display a simple code snippet users need to add to their main.{js|ts} file
  • We reuse the same DSN as the Laravel application for now

The focus is on frontend error reporting, performance monitoring might be added in the future.

Vue.js snippet

import * as Sentry from "@sentry/vue";
import { BrowserTracing } from "@sentry/tracing";

Sentry.init({
  app,
  dsn: "https://[email protected]/0",
  integrations: [new BrowserTracing()],
});

React snippet

import * as Sentry from "@sentry/react";
import { BrowserTracing } from "@sentry/tracing";

Sentry.init({
  dsn: "https://[email protected]/0",
  integrations: [new BrowserTracing()],
});

Livewire snippet

// TBD

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions