{"id":21194254,"url":"https://github.com/huyanhai/sentry-vite-plugin","last_synced_at":"2026-05-15T12:04:48.413Z","repository":{"id":50439158,"uuid":"444626125","full_name":"huyanhai/sentry-vite-plugin","owner":"huyanhai","description":"Upload sourcemap to sentry using vite","archived":false,"fork":false,"pushed_at":"2022-03-24T01:52:43.000Z","size":20,"stargazers_count":0,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-26T06:26:58.238Z","etag":null,"topics":["sentry-client","vite"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/huyanhai.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-01-05T01:54:37.000Z","updated_at":"2022-03-30T22:00:41.000Z","dependencies_parsed_at":"2022-08-31T01:50:27.596Z","dependency_job_id":null,"html_url":"https://github.com/huyanhai/sentry-vite-plugin","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/huyanhai/sentry-vite-plugin","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/huyanhai%2Fsentry-vite-plugin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/huyanhai%2Fsentry-vite-plugin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/huyanhai%2Fsentry-vite-plugin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/huyanhai%2Fsentry-vite-plugin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/huyanhai","download_url":"https://codeload.github.com/huyanhai/sentry-vite-plugin/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/huyanhai%2Fsentry-vite-plugin/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269181020,"owners_count":24373846,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-06T02:00:09.910Z","response_time":99,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["sentry-client","vite"],"created_at":"2024-11-20T19:20:49.372Z","updated_at":"2026-05-15T12:04:43.374Z","avatar_url":"https://github.com/huyanhai.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 基于 vite 的 sentry 上传插件\n\n### 具体配置同@sentry/webpack-plugin\n\n### 新增 cleanSourceMap 参数,上传完毕后删除源目录的.js.map 文件\n\n```ts\n// .sentryclirc文件配置\n[defaults]\nurl =\norg =\nproject =\n\n[auth]\ntoken =\n```\n\n```ts\nimport sentry from \"sentry-vite-plugin\";\nimport { defineConfig } from \"vite\";\n\ndefineConfig({\n  plugins: [\n    sentry({\n      include: \"./dist\",\n      release: `release@${version}`,\n      ignore: [\"node_modules\", \"vite.config.js\"],\n      configFile: \"sentry.properties\",\n      cleanSourceMap: false,\n    }),\n  ],\n});\n```\n\n#### Options\n\n| Option             | Type                                                                                | Required | Description                                                                                                                                                                                                                                                                                                                                                                     |\n| ------------------ | ----------------------------------------------------------------------------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| cleanSourceMap     | `boolean`                                                                           | optional | Upload after clean files by .js.map                                                                                                                                                                                                                                                                                                                                             |\n| 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](#include) for details.                                                                                                                               |\n| org                | `string`                                                                            | optional | The slug of the Sentry organization associated with the app.                                                                                                                                                                                                                                                                                                                    |\n| project            | `string`                                                                            | optional | The slug of the Sentry project associated with the app.                                                                                                                                                                                                                                                                                                                         |\n| 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).                                                                                                                                               |\n| url                | `string`                                                                            | optional | The base URL of your Sentry instance. Defaults to https://sentry.io/, which is the correct value for SAAS customers.                                                                                                                                                                                                                                                            |\n| vcsRemote          | `string`                                                                            | optional | The name of the remote in the version control system. Defaults to `origin`.                                                                                                                                                                                                                                                                                                     |\n| release            | `string`                                                                            | optional | Unique identifier for the 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**).          |\n| dist               | `string`                                                                            | optional | Unique identifier for the distribution, used to further segment your release. Usually your build number.                                                                                                                                                                                                                                                                        |\n| 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.                                                                                                                                                                                                                                                               |\n| ignoreFile         | `string`                                                                            | optional | Path to a file containing list of files/directories to ignore. Can point to `.gitignore` or anything with the same format.                                                                                                                                                                                                                                                      |\n| 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']`.                                                                                                                                                                                                             |\n| 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                                                                                                                       |\n| ext                | `array`                                                                             | optional | The file extensions to be considered. By default the following file extensions are processed: `js`, `map`, `jsbundle`, and `bundle`.                                                                                                                                                                                                                                            |\n| 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'`.                                                                                                                                                             |\n| urlSuffix          | `string`                                                                            | optional | URL suffix to add to the end of all filenames. Useful for appending query parameters.                                                                                                                                                                                                                                                                                           |\n| 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.                                                                                                                               |\n| 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.                                                                                                                                                          |\n| stripCommonPrefix  | `boolean`                                                                           | optional | When paired with `rewrite`, will add `~` to the `stripPrefix` array. Defaults to `false`.                                                                                                                                                                                                                                                                                       |\n| 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`.                                                   |\n| 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`                                                                                                                                                                                                                                    |\n| finalize           | `boolean`                                                                           | optional | Determines whether Sentry release record should be automatically finalized (`date_released` timestamp added) after artifact upload. Defaults to `true`                                                                                                                                                                                                                          |\n| dryRun             | `boolean`                                                                           | optional | Attempts a dry run (useful for dev environments). Defaults to `false`.                                                                                                                                                                                                                                                                                                          |\n| debug              | `boolean`                                                                           | optional | Print useful debug information. Defaults to `false`.                                                                                                                                                                                                                                                                                                                            |\n| silent             | `boolean`                                                                           | optional | Suppresses all logs (useful for `--json` option). Defaults to `false`.                                                                                                                                                                                                                                                                                                          |\n| cleanArtifacts     | `boolean`                                                                           | optional | Remove all the artifacts in the release before the upload. Defaults to `false`.                                                                                                                                                                                                                                                                                                 |\n| 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) =\u003e { compilation.warnings.push('Sentry CLI Plugin: ' + err.message) }`. Defaults to `(err, invokeErr) =\u003e { invokeErr() }`. |\n| setCommits         | `Object`                                                                            | optional | Adds commits to Sentry. See [table below](#setCommits) for details.                                                                                                                                                                                                                                                                                                             |\n| deploy             | `Object`                                                                            | optional | Creates a new release deployment in Sentry. See [table below](#deploy) for details.                                                                                                                                                                                                                                                                                             |\n\n#### \u003ca name=\"include\"\u003e\u003c/a\u003eoptions.include:\n\n| Option             | Type             | Required | Description                                    |\n| ------------------ | ---------------- | -------- | ---------------------------------------------- |\n| paths              | `array`          | required | One or more paths to scan for files to upload. |\n| ignoreFile         | `string`         | optional | See above.                                     |\n| ignore             | `string`/`array` | optional | See above.                                     |\n| ext                | `array`          | optional | See above.                                     |\n| urlPrefix          | `string`         | optional | See above.                                     |\n| urlSuffix          | `string`         | optional | See above.                                     |\n| stripPrefix        | `array`          | optional | See above.                                     |\n| stripCommonPrefix  | `boolean`        | optional | See above.                                     |\n| sourceMapReference | `boolean`        | optional | See above.                                     |\n| rewrite            | `boolean`        | optional | See above.                                     |\n\n#### \u003ca name=\"setCommits\"\u003e\u003c/a\u003eoptions.setCommits:\n\n| Option         | Type      | Required  | Description                                                                                                                                                                                                              |\n| -------------- | --------- | --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |\n| repo           | `string`  | see notes | The full git repo name as defined in Sentry. Required if `auto` option is not `true`, otherwise optional.                                                                                                                |\n| commit         | `string`  | see notes | The current (most recent) commit in the release. Required if `auto` option is not `true`, otherwise optional.                                                                                                            |\n| 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`.                                        |\n| auto           | `boolean` | optional  | Automatically set `commit` and `previousCommit`. Defaults `commit` to `HEAD` and `previousCommit` as described above. Overrides other options                                                                            |\n| 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. |\n\n#### \u003ca name=\"deploy\"\u003e\u003c/a\u003eoptions.deploy:\n\n| Option   | Type     | Required | Description                                                                      |\n| -------- | -------- | -------- | -------------------------------------------------------------------------------- |\n| env      | `string` | required | Environment value for the release, for example `production` or `staging`.        |\n| started  | `number` | optional | UNIX timestamp for deployment start.                                             |\n| finished | `number` | optional | UNIX timestamp for deployment finish.                                            |\n| time     | `number` | optional | Deployment duration in seconds. Can be used instead of `started` and `finished`. |\n| name     | `string` | optional | Human-readable name for this deployment.                                         |\n| url      | `string` | optional | URL that points to the deployment.                                               |\n\nYou can find more information about these options in our official docs:\nhttps://docs.sentry.io/product/cli/releases/#sentry-cli-sourcemaps.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhuyanhai%2Fsentry-vite-plugin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhuyanhai%2Fsentry-vite-plugin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhuyanhai%2Fsentry-vite-plugin/lists"}