universal-router v4.0.0 Release Notes
Release Date: 2017-09-15 // over 6 years ago-
- ๐ 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$/
- ๐ Rename