1.3.10 • Published 4 years ago
@ysfe/sentry-webpack-plugin v1.3.10
@ysfe/sentry-webpack-plugin
sentry cli 的 webpack 插件集成.
前置依赖
- node >= 8.0.0
- 4.x <= webpack < 5.x
开发指引
使用方式
以下结合 vue 应用场景, 整理使用文档
- 安装: 执行 yarn add @ysfe/sentry-webpack-plugin --dev安装插件
- 使用: - 在 vue.config.js中, 引用插件.
 - const { SentryAutocWebpackPlugin } = require('@ysfe/sentry-webpack-plugin') // 通过 configureWebpack 配置 module.exports = { configureWebpack: { plugins: [ new SentryAutocWebpackPlugin(), // other plugins ... ] } } // or 通过 chainWebpack 配置 module.exports = { chainWebpack: (config) => { // add plugin config .plugin('SentryAutocPlugin') .use(new SentryAutocWebpackPlugin({ /* options ... */ })) } }
- 在 
- 备注: - 关于环境判断: 默认情况下, 仅在 process.env.NODE_ENV === 'production'时, 启用插件. 可通过options.disable在任意场景下禁用插件.
 
- 关于环境判断: 默认情况下, 仅在 
命令行参数
- (1.2.1 新增) 执行编译命令时, 如果命令行增加参数 --tag=[git tag], 则直接采用git tag名称作为 sentry 版本号, 且不再提交备份的 git tag.
杂项
插件构造函数参数
/** sentry-autoc 配置 */
export interface SentryAutocPluginOptions {
    /** 禁用 sentry autoc 插件, 默认情况下会主动判断当前的NODE_ENV ==='production' */
    disable?: boolean
    /** 禁用 git tag 备份 */
    disableGitTagBackup?: boolean
    /** sentry cli 配置 */
    /** sentry 项目dsn内容, 必填 */
    dsn: string
    /** sentry 要提交哪些文件, 默认值: './dist'  */
    include?: string | Array<string>
    /** 手工指定版本号 */
    release?: string
    /** sentry 服务地址 */
    url?: string
    /** sentry user auth token */
    authToken?: string
    /** user Organization slug */
    org?: string
    /** sentry project name */
    project?: string
    /** VCS remote name, 作用位置 */
    vcsRemote?: string
    /**
     * Determines whether processed release should be automatically finalized after artifacts upload.
     * Defaults to `true`.
     */
    finalize?: boolean
    /** 手工指定 @sentry/cli 配置文件.
     *
     * @doc https://docs.sentry.io/learn/cli/configuration/#properties-files.
     */
    configFilePath?: string
}release 生成规则
- 当指定命令行参数 --tag=[tag name]时, 直接采用 tag 参数作为sentry.release版本号. 且不再提交备份 tag.
- 当未指定 --tag参数,- 存在 git repo 时, 生成 sentry_[month][day][index], 例: sentry_033001. 并推送同名 tag
- 不存在 git repo 时, 使用 package.json中的 version 字段作为版本号. (此时版本号不会自动更新)
 
- 存在 git repo 时, 生成 
版本说明
版本说明
起步版本, 1.1.0 以上版本忽略.
1.3.6
- 增加sentry错误捕获忽略项
1.3.4
- 移除 process.env.NODE_ENV==='production' 判断, 这里这样加开关会引起误解.
1.3.3
- 增加 include 检查, 允许 serve 时, 启用 sentry 上报, 但不发布 source map.
1.3.2
- 更新 sentry 插件版本
v1.2.2
- 更改 webpack 版本, 生成对 webpack4 的支持.
v1.2.1
- 更新 sentry.release生成规则. 引入命令行参数--tag
v1.1.2
- 重写 @sentry/webpack-plugin, 简化不常用的配置项.
- 增加 release字段自动生成. 但最好使用git tag来作为版本标记.
- 增加 自定义 git tag备份.
- 主动注入 sentry runtime code, 但是要注意, 这个版本并未做去重处理. 请移除手工引入的 sentry.