Skip to content

Commit cc0288f

Browse files
mydeaLuca Forstnerlizokm
authored
feat: Add docs about when to use the loader/npm (#8249)
--------- Co-authored-by: Luca Forstner <luca.forstner@sentry.io> Co-authored-by: Liza Mock <liza.mock@sentry.io>
1 parent c6273e3 commit cc0288f

File tree

1 file changed

+33
-0
lines changed
  • src/platforms/javascript/common/install

1 file changed

+33
-0
lines changed

src/platforms/javascript/common/install/index.mdx

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,36 @@ notSupported:
2020
---
2121

2222
<PageGrid />
23+
24+
## How To Decide Which Installation Method To Use
25+
26+
Depending on the concrete needs of your application, you may wonder which installation method you should use.
27+
28+
### Why Choose the Loader Script Over NPM
29+
30+
Using the Loader Script is the easiest way to start using Sentry. Add a script tag to your application, and we'll take care of setting everything else up correctly for you.
31+
32+
- **Easy to set up**: Just [add a script tag](./loader/#using-the-loader) to your application.
33+
34+
- **Easy to upgrade**: We'll take care of always shipping the latest version of the SDK to your users. No action's needed from you. This ensures you'll always get the latest features and bug fixes of the Sentry SDK.
35+
36+
- **Easy to add additional configuration**: You can [configure the SDK](./loader/#sdk-configuration) to your liking via `Sentry.onLoad()`.
37+
38+
- **Lazy-loading**: If you just want to use Sentry for errors, we'll only load the SDK when an error occurs, reducing the amount of JavaScript loaded on your page until then.
39+
40+
<Note>
41+
Note that when enabling Session Replay and/or Performance Monitoring, the
42+
SDK will be loaded immediately because we need to capture what's happening
43+
on the page as early as possible.
44+
</Note>
45+
46+
### Why Choose NPM Over the Loader Script
47+
48+
While using the Loader Script has definite advantages, it also comes with some drawbacks.
49+
In these scenarios, using the npm package is the better choice:
50+
51+
- **Framework-specific initialization**: As of now, the Loader Script only provides generic Browser JavaScript instrumentation. This means that you won't get any React, Vue, or similar framework-specific features for Sentry. To get these features, you'll need to install the framework SDK (e.g. `@sentry/react` or `@sentry/vue`) via npm.
52+
53+
- **Full public API**: The Loader Script only exposes a subset of public APIs (for example, `Sentry.captureException()`, ...). If you need a lot of custom functionality, you're likely better off with the npm package.
54+
55+
- **Full control over the SDK version**: If you need full control over the SDK version, you'll need to install the SDK via npm.

0 commit comments

Comments
 (0)