• This repository has been archived on 20/Nov/2023
  • Stars
    star
    662
  • Rank 68,103 (Top 2 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created about 7 years ago
  • Updated 12 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Repo moved to https://github.com/getsentry/sentry-javascript-bundler-plugins. Please open any issues/PRs there.

Sentry

Moved!

⚠️ Notice: The repository for the @sentry/webpack-plugin package moved to https://github.com/getsentry/sentry-javascript-bundler-plugins.

Please open any issues and PRs over there, as this repository is no longer maintained!

Sentry Webpack Plugin

A webpack plugin acting as an interface to Sentry CLI.

Installation

@sentry/webpack-plugin requires at least [email protected] or any webpack@5 version to be installed.

Using npm:

$ npm install @sentry/webpack-plugin --save-dev

Using yarn:

$ yarn add @sentry/webpack-plugin --dev

CLI Configuration

You can use either .sentryclirc file or ENV variables described here https://docs.sentry.io/cli/configuration.

Usage

const SentryWebpackPlugin = require('@sentry/webpack-plugin');

const config = {
  plugins: [
    new SentryWebpackPlugin({
      include: '.',
      ignoreFile: '.sentrycliignore',
      ignore: ['node_modules', 'webpack.config.js'],
      configFile: 'sentry.properties',
    }),
  ],
};

Also, check the example directory.

Options

Option Type Required Description
include string/array/object required One or more paths that Sentry CLI should scan recursively for sources. It will upload all .map files and match associated .js files. Each path can be given as an object with path-specific options. See table below for details.
org string optional The slug of the Sentry organization associated with the app. Can also be specified via process.env.SENTRY_ORG.
project string optional The slug of the Sentry project associated with the app. Can also be specified via process.env.SENTRY_PROJECT.
authToken string optional The authentication token to use for all communication with Sentry. Can be obtained from https://sentry.io/settings/account/api/auth-tokens/. Required scopes: project:releases (and org:read if setCommits option is used).
url string optional The base URL of your Sentry instance. Defaults to https://sentry.io/, which is the correct value for SAAS customers.
customHeader string optional A header added to all outgoing requests. A string in the format header-key: header-value
vcsRemote string optional The name of the remote in the version control system. Defaults to origin.
release string optional Unique identifier for the release. Can also be specified via process.env.SENTRY_RELEASE. Defaults to the output of the sentry-cli releases propose-version command, which automatically detects values for Cordova, Heroku, AWS CodeBuild, CircleCI, Xcode, and Gradle, and otherwise uses HEAD's commit SHA. (For HEAD option, requires access to git CLI and for the root directory to be a valid repository).
dist string optional Unique identifier for the distribution, used to further segment your release. Usually your build number.
entries array/RegExp/function(key: string): bool optional Filter for entry points that should be processed. By default, the release will be injected into all entry points.
ignoreFile string optional Path to a file containing list of files/directories to ignore. Can point to .gitignore or anything with the same format.
ignore string/array optional One or more paths to ignore during upload. Overrides entries in ignoreFile file. If neither ignoreFile nor ignore is present, defaults to ['node_modules'].
configFile string optional Path to Sentry CLI config properties, as described in https://docs.sentry.io/product/cli/configuration/#configuration-file. By default, the config file is looked for upwards from the current path, and defaults from ~/.sentryclirc are always loaded
ext array optional The file extensions to be considered. By default the following file extensions are processed: js, map, jsbundle, and bundle.
urlPrefix string optional URL prefix to add to the beginning of all filenames. Defaults to ~/ but you might want to set this to the full URL. This is also useful if your files are stored in a sub folder. eg: url-prefix '~/static/js'.
urlSuffix string optional URL suffix to add to the end of all filenames. Useful for appending query parameters.
validate boolean optional When true, attempts source map validation before upload if rewriting is not enabled. It will spot a variety of issues with source maps and cancel the upload if any are found. Defaults to false to prevent false positives canceling upload.
stripPrefix array optional When paired with rewrite, will remove a prefix from filename references inside of sourcemaps. Useful for removing a path that is build-machine-specific. Note that this will NOT change the names of uploaded files.
stripCommonPrefix boolean optional When paired with rewrite, will add ~ to the stripPrefix array. Defaults to false.
sourceMapReference boolean optional Determines whether sentry-cli should attempt to link minified files with their corresponding maps. By default, it will match files and maps based on name, and add a Sourcemap header to each minified file for which it finds a map. Can be disabled if all minified files contain sourceMappingURL. Defaults to true.
rewrite boolean optional Enables rewriting of matching source maps so that indexed maps are flattened and missing sources are inlined if possible. Defaults to true
finalize boolean optional Determines whether Sentry release record should be automatically finalized (date_released timestamp added) after artifact upload. Defaults to true
dryRun boolean optional Attempts a dry run (useful for dev environments). Defaults to false, but may be automatically set to true in development environments by some framework integrations (Next.JS, possibly others).
debug boolean optional Print useful debug information. Defaults to false.
silent boolean optional Suppresses all logs (useful for --json option). Defaults to false.
cleanArtifacts boolean optional Remove all the artifacts in the release before the upload. Defaults to false.
errorHandler function(err: Error, invokeErr: function(): void, compilation: Compilation): void optional Function to call a when CLI error occurs. Webpack compilation failure can be triggered by calling invokeErr callback. Can emit a warning rather than an error (allowing compilation to continue) by setting this to (err, invokeErr, compilation) => { compilation.warnings.push('Sentry CLI Plugin: ' + err.message) }. Defaults to (err, invokeErr) => { invokeErr() }.
setCommits Object optional Adds commits to Sentry. See table below for details.
deploy Object optional Creates a new release deployment in Sentry. See table below for details.

options.include:

Option Type Required Description
paths array required One or more paths to scan for files to upload.
ignoreFile string optional See above.
ignore string/array optional See above.
ext array optional See above.
urlPrefix string optional See above.
urlSuffix string optional See above.
stripPrefix array optional See above.
stripCommonPrefix boolean optional See above.
sourceMapReference boolean optional See above.
rewrite boolean optional See above.

Example:

const SentryWebpackPlugin = require('@sentry/webpack-plugin');

const config = {
  plugins: [
    new SentryWebpackPlugin({
      include: [
        {
          paths: ['./packages'],
          urlPrefix: '~/path/to/packages',
        },
        {
          paths: ['./client'],
          urlPrefix: '~/path/to/client',
        },
      ],
      ignoreFile: '.sentrycliignore',
      ignore: ['node_modules', 'webpack.config.js'],
      configFile: 'sentry.properties',
    }),
  ],
};

options.setCommits:

Option Type Required Description
repo string see notes The full git repo name as defined in Sentry. Required if auto option is not true, otherwise optional.
commit string see notes The current (most recent) commit in the release. Required if auto option is not true, otherwise optional.
previousCommit string optional The last commit of the previous release. Defaults to the most recent commit of the previous release in Sentry, or if no previous release is found, 10 commits back from commit.
auto boolean optional Automatically set commit and previousCommit. Defaults commit to HEAD and previousCommit as described above. Overrides other options
ignoreMissing boolean optional When the flag is set and the previous release commit was not found in the repository, will create a release with the default commits count (or the one specified with --initial-depth) instead of failing the command.

options.deploy:

Option Type Required Description
env string required Environment value for the release, for example production or staging.
started number optional UNIX timestamp for deployment start.
finished number optional UNIX timestamp for deployment finish.
time number optional Deployment duration in seconds. Can be used instead of started and finished.
name string optional Human-readable name for this deployment.
url string optional URL that points to the deployment.

You can find more information about these options in our official docs: https://docs.sentry.io/product/cli/releases/#sentry-cli-sourcemaps.

More Repositories

1

sentry

Developer-first error tracking and performance monitoring
Python
38,989
star
2

sentry-javascript

Official Sentry SDKs for JavaScript
TypeScript
7,952
star
3

self-hosted

Sentry, feature-complete and packaged up for low-volume deployments and proofs-of-concept
Shell
7,663
star
4

responses

A utility for mocking out the Python Requests library.
Python
4,127
star
5

sentry-php

The official PHP SDK for Sentry (sentry.io)
PHP
1,817
star
6

raven-python

Raven is the legacy Python client for Sentry (getsentry.com) — replaced by sentry-python
Python
1,678
star
7

sentry-react-native

Official Sentry SDK for React Native
TypeScript
1,566
star
8

sentry-python

The official Python SDK for Sentry.io
Python
1,533
star
9

sentry-laravel

The official Laravel SDK for Sentry (sentry.io)
PHP
1,157
star
10

sentry-java

A Sentry SDK for Java, Android and other JVM languages.
Kotlin
1,154
star
11

sentry-ruby

Sentry SDK for Ruby
Ruby
927
star
12

sentry-go

The official Go SDK for Sentry (sentry.io)
Go
917
star
13

sentry-cli

A command line utility to work with Sentry.
Rust
833
star
14

sentry-cocoa

The official Sentry SDK for iOS, tvOS, macOS, watchOS.
Objective-C
803
star
15

milksnake

A setuptools/wheel/cffi extension to embed a binary data in wheels
Python
764
star
16

sentry-symfony

The official Symfony SDK for Sentry (sentry.io)
PHP
687
star
17

freight

Freight is a service which aims to make application deployments better.
Python
610
star
18

sentry-elixir

The official Elixir SDK for Sentry (sentry.io)
Elixir
597
star
19

sentry-dotnet

Sentry SDK for .NET
C#
576
star
20

raven-go

Sentry client in Go
Go
560
star
21

sentry-rust

Official Sentry SDK for Rust
Rust
515
star
22

raven-node

A standalone (Node.js) client for Sentry
JavaScript
457
star
23

symbolic

Stack trace symbolication library written in Rust
Rust
440
star
24

action-release

GitHub Action for creating a release on Sentry
TypeScript
424
star
25

sentry-kubernetes

Kubernetes event reporter for Sentry
Python
408
star
26

sentry-native

Sentry SDK for C, C++ and native applications.
C
397
star
27

pdb

A parser for Microsoft PDB (Program Database) debugging information
Rust
385
star
28

symbolicator

Native Symbolication as a Service
Rust
357
star
29

spotlight

Your Universal Debug Toolbar
TypeScript
356
star
30

docker-sentry

Docker Official Image packaging for Sentry
Python
348
star
31

sentry-docs

Sentry's documentation (and tools to build it)
MDX
331
star
32

rb

Routing and connection management for Redis in Python
Python
300
star
33

sentry-php-sdk

This is a meta package to ship sentry-php with a recommend http client.
298
star
34

snuba

Search the seas for your lost treasure.
Python
272
star
35

relay

Sentry event forwarding and ingestion service.
Rust
246
star
36

raven-csharp

Superseded by: https://github.com/getsentry/sentry-dotnet
C#
232
star
37

sentry-electron

The official Sentry SDK for Electron
TypeScript
217
star
38

sentry-plugins

Official plugins for Sentry server
Python
212
star
39

zeus

WIP: A dashboard for CI
Python
209
star
40

sentry-unity

Development of Sentry SDK for Unity
C#
208
star
41

sentry-wizard

Sentry Project Setup Wizard
TypeScript
192
star
42

rust-sourcemap

A library for rust that implements basic sourcemap handling
Rust
188
star
43

action-github-app-token

Gets a GitHub auth token for a GitHub App installation
TypeScript
184
star
44

sentry-android-gradle-plugin

Gradle plugin for Sentry Android. Upload proguard, debug files, and more.
Kotlin
142
star
45

sentry-fastlane-plugin

Official fastlane plugin for Sentry
Ruby
136
star
46

sentry-slack

DEPRECATED Slack integration for Sentry
Python
135
star
47

sentry-javascript-bundler-plugins

JavaScript Bundler Plugins for Sentry
TypeScript
133
star
48

action-git-diff-suggestions

This GitHub Action will take the current git changes and apply them as GitHub code review suggestions
TypeScript
122
star
49

examples

Collection of all different kinds of Sentry SDKs and integrations
C#
119
star
50

craft

The universal Sentry release CLI 🚀
TypeScript
118
star
51

sentry-capacitor

The official Sentry SDK for Capacitor
TypeScript
117
star
52

sentry-kotlin-multiplatform

Sentry SDK for Kotlin Multiplatform
Kotlin
104
star
53

sentry-clj

Sentry SDK for Clojure
Clojure
103
star
54

raven-objc

This SDK is deprecated. Use https://github.com/getsentry/sentry-cocoa
Objective-C
98
star
55

sentry-jira

A Plugin for sentry that lets you create JIRA issues
Python
95
star
56

raven-aiohttp

An aiohttp transport for raven-python
Python
90
star
57

sentry-android

MOVED: https://github.com/getsentry/sentry-java
87
star
58

sentry-unreal

Unreal Engine
C++
84
star
59

pytest-responses

py.test integration for responses
Python
83
star
60

sentry-github

A Sentry extension which integrates with GitHub.
Python
79
star
61

libsourcemap

DEPRECATED: Implements efficient sourcemap processing for Python in Rust
Rust
78
star
62

sentry-rrweb

Moved to: https://github.com/getsentry/sentry-javascript/tree/master/packages/replay#sentry-session-replay
TypeScript
73
star
63

sentry-cordova

The official Sentry SDK for Cordova
TypeScript
68
star
64

sentry-dart-plugin

A Dart Build Plugin that uploads debug symbols for Android, iOS/macOS and source maps for Web to Sentry via sentry-cli
Dart
66
star
65

sourcemaps.io

Web-based Source Map validator
TypeScript
58
star
66

breakpad-tools

Prebuilt tools and examples to work with Breakpad's minidumps
Makefile
56
star
67

dotnet-assembly-alias

Tool to rename .NET assemblies and references
C#
53
star
68

sentry-webhooks

An extension for Sentry which allows creation various web hooks.
Python
52
star
69

sentry-netlify-build-plugin

The Sentry Netlify build plugin automatically notifies Sentry of new releases being deployed to your site.
JavaScript
46
star
70

sentry-mobile-release-health-app

Sentry Mobile App
Dart
44
star
71

sentry-xamarin

Sentry for Xamarin Native and Xamarin.Forms
C#
44
star
72

develop

TypeScript
43
star
73

babel-gettext-extractor

A fork of babel-gettext-plugin that works with older versions of node and supports comment and location extraction
JavaScript
43
star
74

raven-swift

This SDK is deprecated. Use https://github.com/getsentry/sentry-cocoa
40
star
75

pytest-sentry

Track flaky tests in Sentry
Python
39
star
76

sentry-auth-github

GitHub SSO provider for Sentry
Python
39
star
77

arroyo

A library to build streaming applications that consume from and produce to Kafka.
Python
39
star
78

action-visual-snapshot

Save and compare your visual snapshots
TypeScript
38
star
79

sentry-fullstory

The Sentry-FullStory integration seamlessly integrates the Sentry and FullStory platforms.
TypeScript
37
star
80

sentry-phabricator

A Sentry extension which integrates with Phabricator
Python
36
star
81

platformicons

A platform and framework icon font.
TypeScript
36
star
82

sentry-auth-google

Google Apps SSO provider for Sentry
Python
34
star
83

integration-platform-example

An example kanban application which explores the ways developers can build apps on Sentry's integration platform
TypeScript
32
star
84

unity

Unity SDK UPM package
Objective-C
31
star
85

vanguard

TypeScript
29
star
86

profiling-node

The code for this repo now lives in https://github.com/getsentry/sentry-javascript/tree/develop/packages/profiling-node
TypeScript
29
star
87

symbol-collector

Clients and Server to collect system symbols.
C#
29
star
88

sentry-vscode

VSCode editor integration for Sentry
TypeScript
28
star
89

probot-report

Probot app that sends periodic reminder emails for outstanding PR reviews
JavaScript
28
star
90

hackweek-coda

A queue thing with a sprinkle of Italian
Python
27
star
91

sentry-replay

Moved to http://github.com/getsentry/sentry-javascript
TypeScript
27
star
92

perl-raven

A perl sentry client
Perl
26
star
93

sentry_airflow

Airflow integration with Sentry (https://sentry.io)
Python
26
star
94

cloud-run-typescript-template

Template for Google Cloud Run (typescript)
JavaScript
24
star
95

symsynd

C++
23
star
96

sentry-relay-attic

A relay server for Sentry (https://getsentry.com)
Rust
23
star
97

freight-cli

A command line interface to Freight
Python
22
star
98

xds

xDS service for Envoy
Go
22
star
99

atlas

A map to your company
Python
22
star
100

gib-potato

More Potato, more awesome 🥔
PHP
21
star