esbuild
You can use the Sentry esbuild plugin to automatically create releases and upload source maps to Sentry when bundling your app.
Install
Copied
npm install @sentry/esbuild-plugin --save-dev
Configure
Learn more about configuring the plugin in our Sentry esbuild Plugin documentation.
Example:
esbuild.config.js
Copied
const { sentryEsbuildPlugin } = require("@sentry/esbuild-plugin");
require("esbuild").build({
entryPoints: ["./src/index.js"],
outdir: "./dist",
bundle: true,
sourcemap: true, // Source map generation must be turned on
plugins: [
// Put the Sentry esbuild plugin after all other plugins
sentryEsbuildPlugin({
org: "example-org",
project: "example-project",
// Auth tokens can be obtained from https://sentry.io/settings/account/api/auth-tokens/
// and need `project:releases` and `org:read` scopes
authToken: process.env.SENTRY_AUTH_TOKEN,
sourcemaps: {
// Specify the directory containing build artifacts
assets: "./dist/**",
},
// Use the following option if you're on an SDK version lower than 7.47.0:
// include: "./dist",
// Optionally uncomment the line below to override automatic release name detection
// release: process.env.RELEASE,
}),
],
});
Help improve this content
Our documentation is open source and available on GitHub. Your contributions are welcome, whether fixing a typo (drat!) to suggesting an update ("yeah, this would be better").
Our documentation is open source and available on GitHub. Your contributions are welcome, whether fixing a typo (drat!) to suggesting an update ("yeah, this would be better").
- Package:
- npm:@sentry/react
- Version:
- 7.51.0
- Repository:
- https://github.com/getsentry/sentry-javascript