Commit 3f953f9
authored
fix(node): Make sure modulesIntegration does not crash esm apps (#14169)
resolves #12500
resolves #14165
`modulesIntegration` uses top-level require which will crash ESM apps if
you explicitly import and use the integration.
```mjs
// index.mjs
Sentry.init({
dsn: '__DSN__',
integrations: [
Sentry.modulesIntegration(),
]
});
```
This fixes that by adding a boolean check for cjs apps, and logging out
a warning as a result.1 parent 6729214 commit 3f953f9
File tree
3 files changed
+38
-0
lines changed- dev-packages/node-integration-tests/suites/esm/modules-integration
- packages/node/src/integrations
3 files changed
+38
-0
lines changedLines changed: 10 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
Lines changed: 12 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
5 | 8 | | |
6 | 9 | | |
7 | 10 | | |
8 | 11 | | |
9 | 12 | | |
10 | 13 | | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
11 | 25 | | |
12 | 26 | | |
13 | 27 | | |
| |||
23 | 37 | | |
24 | 38 | | |
25 | 39 | | |
| 40 | + | |
| 41 | + | |
26 | 42 | | |
27 | 43 | | |
28 | 44 | | |
| |||
0 commit comments