Skip to content

Commit c245cf7

Browse files
committed
fix: Add safeguard for detection wrong init
1 parent 35929ed commit c245cf7

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

packages/vue/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
"tslib": "^1.9.3"
2525
},
2626
"peerDependencies": {
27-
"vue": "2.x"
27+
"vue": "2.x || 3.x"
2828
},
2929
"devDependencies": {
3030
"@sentry-internal/eslint-config-sdk": "5.27.3",

packages/vue/src/sdk.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,6 @@ export class VueHelper {
177177
*/
178178
public constructor(options: VueOptions) {
179179
this._options = options;
180-
181180
this._attachErrorHandler();
182181

183182
// TODO: Use other check to determine if tracing is enabled
@@ -341,9 +340,12 @@ export class VueHelper {
341340
/** Inject configured tracing hooks into Vue's component lifecycles */
342341
private _startTracing(): void {
343342
const applyTracingHooks = this._applyTracingHooks;
344-
343+
const appliedTracingHooks = setTimeout(() => {
344+
logger.warn("Didn't apply tracing hooks, make sure you call Sentry.init before initialzing Vue!");
345+
}, 500);
345346
this._options.Vue.mixin({
346347
beforeCreate(this: ViewModel): void {
348+
clearTimeout(appliedTracingHooks);
347349
applyTracingHooks(this);
348350
},
349351
});

0 commit comments

Comments
 (0)