File tree Expand file tree Collapse file tree 4 files changed +25
-5
lines changed Expand file tree Collapse file tree 4 files changed +25
-5
lines changed Original file line number Diff line number Diff line change @@ -117,7 +117,10 @@ function initSDK() {
117117 Sentry . init ( {
118118 dsn : 'https://public@example.com/1' ,
119119 // debug: true,
120- integrations : [ new SentryIntegration . Dedupe ( ) ] ,
120+ integrations : [
121+ ( Sentry . Integrations && Sentry . Integrations . Dedupe && new Sentry . Integrations . Dedupe ( ) ) ||
122+ ( SentryIntegrations && new SentryIntegrations . Dedupe ( ) ) ,
123+ ] ,
121124 attachStacktrace : true ,
122125 transport : DummyTransport ,
123126 ignoreErrors : [ 'ignoreErrorTest' ] ,
Original file line number Diff line number Diff line change 66 < title > </ title >
77 < script src ="polyfills/es6-promise-4.2.5.auto.js "> </ script >
88 < script src ="polyfills/whatwg-fetch-3.0.0.js "> </ script >
9- < script src ="dedupe.js "> </ script >
109 < script src ="common.js "> </ script >
1110 < script src ="../../build/bundle.js "> </ script >
11+ < script src ="dedupe.js "> </ script >
1212 < script src ="init.js "> </ script >
1313</ head >
1414
Original file line number Diff line number Diff line change 11const Sentry = require ( '../../dist/index.js' ) ;
2+ const Integrations = require ( '../../../integrations/dist/dedupe.js' ) ;
23
34// Init
45Sentry . init ( {
56 dsn : 'https://completelyrandom@dsn.asdf/42' ,
7+ integrations : [ new Integrations . Dedupe ( ) ] ,
68 beforeSend ( event ) {
79 console . log ( 'Got an event' ) ;
810 return null ;
Original file line number Diff line number Diff line change @@ -53,12 +53,27 @@ function toPascalCase(string) {
5353}
5454
5555function mergeIntoSentry ( name ) {
56- return `window.SentryIntegration = window.SentryIntegration || {}; \n
57- window.SentryIntegration.${ name } = exports.${ name } ;` ;
56+ return `
57+ if (window.Sentry && window.Sentry.Integrations) {
58+ window.Sentry.Integrations['${ name } '] = exports.${ name } ;
59+ } else {
60+ if ((typeof __SENTRY_INTEGRATIONS_LOG === 'undefined')) {
61+ console.warn('Sentry.Integrations is not defined, make sure you included this script after the SDK.');
62+ console.warn('In case you were using the loader, we added the Integration is now available under SentryIntegrations.${ name } ');
63+ console.warn('To disable these warning set __SENTRY_INTEGRATIONS_LOG = true; somewhere before loading this script.');
64+ }
65+ window.SentryIntegrations = window.SentryIntegrations || {};
66+ window.SentryIntegrations['${ name } '] = exports.${ name } ;
67+ }
68+ ` ;
69+ }
70+
71+ function allIntegrations ( ) {
72+ return fs . readdirSync ( './src' ) . filter ( file => file != 'modules.ts' ) ;
5873}
5974
6075function loadAllIntegrations ( ) {
61- return fs . readdirSync ( './src' ) . map ( file => ( {
76+ return allIntegrations ( ) . map ( file => ( {
6277 input : `src/${ file } ` ,
6378 output : {
6479 banner : '(function (window) {' ,
You can’t perform that action at this time.
0 commit comments