sentry-miniapp 1.8.2 → 1.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.en.md +35 -0
- package/README.md +35 -0
- package/dist/sentry-miniapp.cjs.js +9 -5
- package/dist/sentry-miniapp.cjs.js.map +1 -1
- package/dist/sentry-miniapp.esm.js +1139 -1014
- package/dist/sentry-miniapp.esm.js.map +1 -1
- package/dist/sentry-miniapp.umd.js +9 -5
- package/dist/sentry-miniapp.umd.js.map +1 -1
- package/dist/types/crossPlatform.d.ts.map +1 -1
- package/dist/types/version.d.ts +1 -1
- package/package.json +2 -2
package/README.en.md
CHANGED
|
@@ -313,6 +313,41 @@ If errors are not being reported, check:
|
|
|
313
313
|
|
|
314
314
|
**Not currently.** Sentry's official Replay feature relies on standard browser DOM (via rrweb recording). Mini programs use a dual-thread architecture without standard DOM access. We recommend using **Breadcrumbs** combined with **custom logging** to reconstruct user action sequences.
|
|
315
315
|
|
|
316
|
+
### 3. How do I monitor the H5 build of a uni-app / Taro project?
|
|
317
|
+
|
|
318
|
+
`sentry-miniapp` **only adapts mini program platforms** and does not implement browser-native signals (`window.onerror`, `fetch` / `XHR` interception, `PerformanceObserver`, etc.). For the H5 build, use Sentry's official [`@sentry/browser`](https://docs.sentry.io/platforms/javascript/) directly — full feature coverage, maintained upstream.
|
|
319
|
+
|
|
320
|
+
> When this SDK is initialized in a browser environment, it logs a warning suggesting you switch to `@sentry/browser`.
|
|
321
|
+
|
|
322
|
+
Recommended pattern: split SDKs by platform via **uni-app conditional compilation**:
|
|
323
|
+
|
|
324
|
+
```ts
|
|
325
|
+
// utils/sentry.ts
|
|
326
|
+
let Sentry: any;
|
|
327
|
+
|
|
328
|
+
// #ifdef H5
|
|
329
|
+
Sentry = require('@sentry/browser');
|
|
330
|
+
Sentry.init({
|
|
331
|
+
dsn: 'YOUR_DSN',
|
|
332
|
+
environment: 'production',
|
|
333
|
+
tracesSampleRate: 0.2,
|
|
334
|
+
});
|
|
335
|
+
// #endif
|
|
336
|
+
|
|
337
|
+
// #ifdef MP-WEIXIN || MP-ALIPAY || MP-BAIDU || MP-TOUTIAO || MP-QQ || MP-KUAISHOU || MP-DINGTALK
|
|
338
|
+
Sentry = require('sentry-miniapp');
|
|
339
|
+
Sentry.init({
|
|
340
|
+
dsn: 'YOUR_DSN',
|
|
341
|
+
environment: 'production',
|
|
342
|
+
tracesSampleRate: 0.2,
|
|
343
|
+
});
|
|
344
|
+
// #endif
|
|
345
|
+
|
|
346
|
+
export default Sentry;
|
|
347
|
+
```
|
|
348
|
+
|
|
349
|
+
Both sides report to the same Sentry DSN so all errors land in a single project. For Taro, use `process.env.TARO_ENV === 'h5'` to branch similarly.
|
|
350
|
+
|
|
316
351
|
---
|
|
317
352
|
|
|
318
353
|
## Documentation
|
package/README.md
CHANGED
|
@@ -328,6 +328,41 @@ App({
|
|
|
328
328
|
目前 **不支持** `Sentry.replayIntegration()`。
|
|
329
329
|
Sentry 官方的 Replay 功能强依赖于浏览器标准 DOM 环境(通过 rrweb 录制)。小程序采用双线程架构且没有开放标准 DOM 接口,无法直接复用。建议通过完善**Breadcrumbs(面包屑路径)**结合**自定义日志**来还原用户操作现场。
|
|
330
330
|
|
|
331
|
+
### 3. uni-app / Taro 项目的 H5 端如何监控?
|
|
332
|
+
|
|
333
|
+
`sentry-miniapp` **仅适配各小程序平台**,不内置浏览器原生信号(`window.onerror`、`fetch` / `XHR` 拦截、`PerformanceObserver` 等)。H5 端请直接使用 Sentry 官方的 [`@sentry/browser`](https://docs.sentry.io/platforms/javascript/),能力完整、长期由官方维护。
|
|
334
|
+
|
|
335
|
+
> SDK 在 H5 环境下被错误初始化时,会输出引导提示,提醒切换到 `@sentry/browser`。
|
|
336
|
+
|
|
337
|
+
推荐通过 **uni-app 条件编译**按端引入:
|
|
338
|
+
|
|
339
|
+
```ts
|
|
340
|
+
// utils/sentry.ts
|
|
341
|
+
let Sentry: any;
|
|
342
|
+
|
|
343
|
+
// #ifdef H5
|
|
344
|
+
Sentry = require('@sentry/browser');
|
|
345
|
+
Sentry.init({
|
|
346
|
+
dsn: 'YOUR_DSN',
|
|
347
|
+
environment: 'production',
|
|
348
|
+
tracesSampleRate: 0.2,
|
|
349
|
+
});
|
|
350
|
+
// #endif
|
|
351
|
+
|
|
352
|
+
// #ifdef MP-WEIXIN || MP-ALIPAY || MP-BAIDU || MP-TOUTIAO || MP-QQ || MP-KUAISHOU || MP-DINGTALK
|
|
353
|
+
Sentry = require('sentry-miniapp');
|
|
354
|
+
Sentry.init({
|
|
355
|
+
dsn: 'YOUR_DSN',
|
|
356
|
+
environment: 'production',
|
|
357
|
+
tracesSampleRate: 0.2,
|
|
358
|
+
});
|
|
359
|
+
// #endif
|
|
360
|
+
|
|
361
|
+
export default Sentry;
|
|
362
|
+
```
|
|
363
|
+
|
|
364
|
+
两端上报同一个 Sentry DSN,可以在同一个 Project 里聚合查看错误。Taro 用户可以用类似的 `process.env.TARO_ENV === 'h5'` 判断分端引入。
|
|
365
|
+
|
|
331
366
|
---
|
|
332
367
|
|
|
333
368
|
## 📖 文档导航
|