diff --git a/packages/vue/src/components/IonBackButton.ts b/packages/vue/src/components/IonBackButton.ts index 25d9d5ff5a..2f86022ff3 100644 --- a/packages/vue/src/components/IonBackButton.ts +++ b/packages/vue/src/components/IonBackButton.ts @@ -10,6 +10,12 @@ export const IonBackButton = /*@__PURE__*/ defineComponent((_, { attrs, slots }) const ionRouter: any = inject('navManager'); const onClick = () => { + /** + * When using ion-back-button outside of + * a routing context, ionRouter is undefined. + */ + if (ionRouter === undefined) { return; } + const defaultHref = attrs['default-href'] || attrs['defaultHref']; const routerAnimation = attrs['router-animation'] || attrs['routerAnimation'];