import { RouterViewDevtoolsContext } from './RouterView'
import { assign, isArray } from './utils'
import { RouteLocationNormalized } from './typed-routes'
+import { warn } from './warning'
/**
* Copies a route location and removes any problematic properties that cannot be shown in devtools (e.g. Vue instances).
},
api => {
if (typeof api.now !== 'function') {
- console.warn(
+ warn(
'[Vue Router]: You seem to be using an outdated version of Vue Devtools. Are you still using the Beta release instead of the stable one? You can find the links at https://devtools.vuejs.org/guide/installation.html.'
)
}
+import { warn } from '../../../warning'
import { decode, MatcherQueryParams } from '../resolver-abstract'
import { miss } from './errors'
}
if (__DEV__ && i !== match.length) {
- console.warn(
+ warn(
`Regexp matched ${match.length} params, but ${i} params are defined. Found when matching "${path}" against ${String(this.re)}`
)
}
MatcherPatternQuery,
MatcherPatternHash,
} from './matchers/matcher-pattern'
+import { warn } from '../../warning'
// TODO: find a better name than static that doesn't conflict with static params
// maybe fixed or simple
if (typeof to === 'object' && (to.name || to.path == null)) {
// relative location by path or by name
if (__DEV__ && to.name == null && currentLocation == null) {
- console.warn(
+ warn(
`Cannot resolve relative location "${JSON.stringify(to)}"without a current location. This will throw in production.`,
to
)
// either one of them must be defined and is catched by the dev only warn above
const name = to.name ?? currentLocation!.name
const record = recordMap.get(name)!
- if (__DEV__ && (!record || !name)) {
- throw new Error(`Record "${String(name)}" not found`)
+
+ if (__DEV__) {
+ if (!record || !name) {
+ throw new Error(`Record "${String(name)}" not found`)
+ }
+
+ if (typeof to === 'object' && to.hash?.startsWith('#')) {
+ warn(
+ `A \`hash\` should always start with the character "#". Replace "${to.hash}" with "#${to.hash}".`
+ )
+ }
}
// unencoded params in a formatted form that the user came up with