4.0.0 - 2017-09-15
- Rename
router.resolve({ path })
torouter.resolve({ pathname })
(BREAKING CHANGE #114) - Rename
context.url
tocontext.pathname
(BREAKING CHANGE #114) - Remove
pretty
option fromgenerateUrls(router, options)
function in favor of newencode
option (BREAKING CHANGE #111) - Update path-to-regexp to v2.0.0, see changelog (BREAKING CHANGE #111)
- Explicitly handle trailing delimiters (e.g.
/test/
is now treated as/test/
instead of/test
when matching) - No wildcard asterisk (
*
) - use parameters instead ((.*)
)
- Explicitly handle trailing delimiters (e.g.
- Add support for repeat parameters (#116)
- Add
encode
option togenerateUrls(router, options)
function for pretty encoding (e.g. pass your own implementation) (#111) - Preserve
context.keys
values from the parent route (#111) - Inherit
context.params
andqueryParams
from Object (e.g.params.hasOwnProperty()
won't throw an exception anymore) (#111) - Include the source code of the router in the npm package (#110)
Migration from v3 to v4:
- Change
router.resolve({ path, ... })
torouter.resolve({ pathname, ... })
- Remove trailing slashes from all paths of your routes, i.e.
path: '/posts/:uri/'
=>path: '/posts/:uri'
path: '/posts/'
=>path: '/posts'
path: '/'
=>path: ''
- etc.
- Replace
path: '*'
withpath: '(.*)'
if any - If you are using webpack, change rule (loader) for
.js
files to include.mjs
extension, i.e.test: /\.js$/
=>test: /\.m?js$/