]> git.ipfire.org Git - thirdparty/vuejs/router.git/commitdiff
refactor: warn only in __DEV__
authorEduardo San Martin Morote <posva13@gmail.com>
Sun, 27 Sep 2020 12:31:03 +0000 (14:31 +0200)
committerEduardo San Martin Morote <posva13@gmail.com>
Sun, 27 Sep 2020 12:31:03 +0000 (14:31 +0200)
src/history/html5.ts
src/router.ts

index 9656b252c3e04195588b5b40fe1cbba1ad32122e..0f91b8daa9412234e23d4f63b2d927a93e027a2a 100644 (file)
@@ -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)
     }
index 4e7365785bb2ea4bed9f2c6799760783254f2006..0527c56f7f97b7ff2af070072819b62511aee070 100644 (file)
@@ -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