title |
---|
Invalid Custom Route `source` |
A pattern could not be parsed when defining custom routes or a middleware matcher
.
This could have been due to trying to use normal RegExp
syntax like negative lookaheads (?!exclude
) without following path-to-regexp
's syntax.
Wrap the RegExp
part of your source
as an un-named parameter.
Before
{
source: '/feedback/(?!general)',
destination: '/feedback/general'
}
After
{
source: '/feedback/((?!general).*)',
destination: '/feedback/general'
}
Before
const config = {
matcher: '/feedback/(?!general)',
}
After
const config = {
matcher: '/feedback/((?!general).*)',
}