Skip to content

Commit 4626523

Browse files
committed
Update
1 parent b2f9add commit 4626523

File tree

1 file changed

+20
-4
lines changed

1 file changed

+20
-4
lines changed

docs/platforms/dart/guides/flutter/configuration/chrome-extensions.mdx

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,38 @@
22
title: Chrome Extensions
33
description: "Learn how to set up the Sentry Flutter SDK for Chrome Extensions with Flutter Web."
44
sidebar_order: 10
5+
sdk: sentry.dart.flutter
6+
categories:
7+
- dart
8+
- flutter
59
---
610

7-
When building Flutter Web applications that will be packaged as Chrome Extensions, there are specific configuration requirements due to Chrome's Content Security Policy (CSP) restrictions. This guide walks you through the necessary setup steps.
11+
<Alert level="warning">
12+
13+
Chrome Extensions enforce strict Content Security Policy (CSP) rules that prevent dynamically loaded scripts. The standard Sentry Flutter SDK setup will not work in Chrome Extension environments without the modifications outlined in this guide.
14+
15+
</Alert>
816

917
## Overview
1018

11-
Chrome Extensions enforce strict Content Security Policy (CSP) rules that prevent dynamically loaded scripts. Since the Sentry Flutter SDK typically loads the Sentry JavaScript SDK dynamically for web platforms, this approach won't work in Chrome Extension environments.
19+
Chrome Extensions enforce strict Content Security Policy (CSP) rules that prevent dynamically loaded scripts. Since the Sentry Flutter SDK typically loads the Sentry JavaScript SDK dynamically for web platforms, you need to include the Sentry JavaScript bundle as a static asset instead.
1220

1321
## Required Setup
1422

1523
### 1. Download the Sentry JavaScript Bundle
1624

1725
Instead of loading the Sentry JavaScript SDK dynamically, you need to include it as a static asset:
1826

19-
1. Download the minified Sentry JavaScript bundle. For example, for version 9.40.0:
27+
1. Download the minified Sentry JavaScript bundle from the Sentry CDN. Use the version that is compatible with the Sentry Flutter SDK:
2028
```
2129
https://browser.sentry-cdn.com/9.40.0/bundle.tracing.min.js
2230
```
31+
32+
<Alert level="info">
33+
34+
Replace `9.40.0` with the appropriate version for your project. Check the [Sentry Flutter SDK releases](https://github.com/getsentry/sentry-dart/releases) to find the version of the Sentry Javascript SDK that is used in a specific Sentry Flutter SDK release.
35+
36+
</Alert>
2337

2438
2. Save this file to your Flutter Web project's `web/` directory.
2539

@@ -44,6 +58,8 @@ Add the Sentry JavaScript bundle to your `web/index.html` file:
4458

4559
Build your Flutter Web app for Chrome Extensions.
4660

61+
Ensure that the `bundle.tracing.min.js` file is included in your `web/` directory before building.
62+
4763
### 4. Upload Source Maps
4864

49-
After building your application, upload the generated source maps to Sentry using the [sentry_dart_plugin](/platforms/dart/guides/flutter/debug-symbols/dart-plugin/).
65+
After building your application, upload the generated source maps to Sentry to enable proper symbolication of stack traces using the [sentry_dart_plugin](/platforms/dart/guides/flutter/debug-symbols/dart-plugin/).

0 commit comments

Comments
 (0)