From: Eduardo San Martin Morote Date: Sun, 27 Sep 2020 12:31:03 +0000 (+0200) Subject: refactor: warn only in __DEV__ X-Git-Tag: v4.0.0-beta.13~20 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2fe6bfc8572105e608919c0e88e5798eb063ca37;p=thirdparty%2Fvuejs%2Frouter.git refactor: warn only in __DEV__ --- 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