-
-
Notifications
You must be signed in to change notification settings - Fork 5k
Warn about root paths without a leading slash (fix #2550) #2591
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
b1c178c
0416191
6121c82
2103945
a094f45
0d867c5
f8d35b4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,6 +34,16 @@ export function createRouteMap ( | |
} | ||
} | ||
|
||
// warn if routes do not include leading slashes | ||
const pathsMissingSlashes = pathList | ||
.filter(path => !!path && path.charAt(0) !== '*' && path.charAt(0) !== '/') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think a single There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. you are totally right! Thank you for catching that, it would fail on IE as well. Then let's keep the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It used to be just comma separated, but one per line sounds better |
||
.map(path => path.split('/')[0]) | ||
.filter((path, index, pathList) => pathList.indexOf(path) === index) | ||
|
||
if (pathsMissingSlashes.length > 0) { | ||
warn(false, `The following routes require a leading slash in their paths: ${pathsMissingSlashes.join(', ')}`) | ||
Sayegh7 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
|
||
return { | ||
pathList, | ||
pathMap, | ||
|
Uh oh!
There was an error while loading. Please reload this page.