From 2fe6bfc8572105e608919c0e88e5798eb063ca37 Mon Sep 17 00:00:00 2001 From: Eduardo San Martin Morote Date: Sun, 27 Sep 2020 14:31:03 +0200 Subject: [PATCH] refactor: warn only in __DEV__ --- src/history/html5.ts | 6 +++++- src/router.ts | 4 ++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/history/html5.ts b/src/history/html5.ts index 9656b252..0f91b8da 100644 --- a/src/history/html5.ts +++ b/src/history/html5.ts @@ -214,7 +214,11 @@ function useHistoryStateNavigation(base: string) { history[replace ? 'replaceState' : 'pushState'](state, '', url) historyState.value = state } catch (err) { - warn('Error with push/replace State', err) + if (__DEV__) { + warn('Error with push/replace State', err) + } else { + console.error(err) + } // Force the navigation, this also resets the call count location[replace ? 'replace' : 'assign'](url) } diff --git a/src/router.ts b/src/router.ts index 4e736578..0527c56f 100644 --- a/src/router.ts +++ b/src/router.ts @@ -477,11 +477,11 @@ export function createRouter(options: RouterOptions): Router { let href = routerHistory.createHref(fullPath) if (__DEV__) { - if (href.startsWith('//')) + if (href.startsWith('//')) { warn( `Location "${rawLocation}" resolved to "${href}". A resolved location cannot start with multiple slashes.` ) - else if (!matchedRoute.matched.length) { + } else if (!matchedRoute.matched.length) { warn( `No match found for location with path "${ 'path' in rawLocation ? rawLocation.path : rawLocation -- 2.47.3