Skip to content

4.0.0 - 2017-09-15

Compare
Choose a tag to compare
@frenzzy frenzzy released this 15 Sep 11:44
  • Rename router.resolve({ path }) to router.resolve({ pathname }) (BREAKING CHANGE #114)
  • Rename context.url to context.pathname (BREAKING CHANGE #114)
  • Remove pretty option from generateUrls(router, options) function in favor of new encode 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 ((.*))
  • Add support for repeat parameters (#116)
  • Add encode option to generateUrls(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 and queryParams 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, ... }) to router.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: '*' with path: '(.*)' if any
  • If you are using webpack, change rule (loader) for .js files to include .mjs extension, i.e.
    • test: /\.js$/ => test: /\.m?js$/