# vue-router 3: the Vue 2 router, its setup, and its end-of-life boundary

> vue-router 3 is the official router for Vue 2, and the README states plainly that both have reached end of life. Here is how it installs, how routing actually works, and who should still pick it.

**vuejs/vue-router** — 🚦 The official router for Vue 2

- Repository: https://github.com/vuejs/vue-router
- Website: http://v3.router.vuejs.org/
- Stars: 18,866 · Forks: 4,965
- Language: JavaScript
- License: MIT
- Published: 2026-09-21 · Updated: 2026-09-21 · Language: en
- Canonical page: https://hysenlabs.com/projects/vuejs-vue-router

## What vue-router 3 solves, and the Vue 2 boundary it sits behind

A single-page Vue 2 application has no server telling it which view to render. vue-router fills that gap: it maps URL paths to components, keeps the address bar and the rendered view in step, and exposes navigation as an API rather than as anchor tags. The README opens with the constraint that matters more than any feature list: this is vue-router 3.0, which works only with Vue 2.0, and both have reached end of life. For Vue 3 the README points elsewhere, to the vuejs/router repository.

So the audience is narrow and specific. You are maintaining a Vue 2 application, you need client-side routing inside it, and migrating the framework is not on the table this quarter. The router is not a general-purpose routing library you would reach for in a new project. It is the piece that makes an existing Vue 2 app navigable, and the README treats it as such.

## How routing works: route records, the router instance, and the navigation flow

The mechanism is a route table plus a router instance injected into the app. Each entry in the table is a route record: a path pattern, optionally a name, and the component to render. Nested routes express layout composition, where a parent record renders a shell and child records fill a named outlet inside it. The repository's examples directory reflects this directly, with separate example folders for nested-routes, named-routes, named-views, route-params, and route-props.

Navigation flows through the history abstraction. vue-router ships both a hash mode and an HTML5 history mode, and the examples include hash-mode and hash-scroll-behavior alongside the default. In history mode the router intercepts link clicks and popstate events, matches the new location against the route table, and resolves the target record. Before that resolution completes, global and per-route guards run in sequence; the README's example list includes a navigation-guards folder, and beforeEach is the guard name people search for most often. A guard can let the navigation through, redirect it, or cancel it, which is how auth gates are usually built.

The package is published with more than one entry point. package.json declares a main field pointing at dist/vue-router.common.js, a module field at dist/vue-router.esm.js, and an exports map with separate import and require conditions, plus a ./composables subpath. That subpath is worth noting, because it exists for a Vue 2 app using the composition API plugin rather than the Options API. The repository also carries composables.js, composables.mjs, and composables.d.ts at the top level and lists them in the files array, so the subpath is a real shipped artifact and not a stub.

## Installing vue-router 3 and getting a first route working

The package is published on npm as vue-router, and the README points to the documentation site at v3.router.vuejs.org for getting started. The README does not reproduce an install command; the package name is the one package.json declares, and the documentation site covers the setup steps.

The README's development setup is the part it does spell out, and it is the fastest way to see the router working before wiring it into an application. Install dependencies, build the dist files, and serve the bundled examples:

```bash
# install deps
yarn

# build dist files
yarn build

# serve examples at localhost:8080
yarn dev
```

That third command serves the examples folder at localhost:8080. The examples directory contains a basic example, a route-matching example, a named-routes example, a route-params example, a route-props example, a nested-routes example, a navigation-guards example, a redirect example, a route-alias example, and a lazy-loading example, among others. Reading the basic example alongside the nested-routes example shows how a route table is written and how a parent record composes with a child record.

There is also a test command the README lists as lint plus all tests, and a docs command that serves the documentation at localhost:8080:

```bash
# lint & run all tests
yarn test

# serve docs at localhost:8080
yarn docs
```

For an application rather than the examples, the README's answer is the documentation site. It does not walk through registering the plugin or mounting the router on a root instance, so treat the documentation as the source for that step.

## Where vue-router 3 stops being the right answer

The end-of-life statement in the README is not boilerplate. Both Vue 2 and this router are past their support window, and the newest release listed is v3.6.5 from 2022-09-06. The repository's default branch is dev and the last push was on 2026-04-14, so the code is not frozen, but a release cadence that stopped in 2022 tells you what to expect from a bug you file.

There is a second, more practical limit. This router is bound to Vue 2's reactivity and component model. If your application is on Vue 3, vue-router 3 will not work, and the README says so in its first line. That is not a configuration problem you can work around; the two are separate packages in separate repositories.

A third case is subtler. If you are building a small application with a handful of views and no need for nested layouts, named views, guards, or scroll behaviour, a router adds a route table, a history abstraction, and a navigation lifecycle that you then have to reason about during every change. For a few static views, conditional rendering in a parent component is less machinery. The router earns its place when URL structure, deep linking, and navigation interception are actual requirements.

## Vue Router 4 and unplugin-vue-router: what changes in the approach

The direct alternative is Vue Router 4, which the README names as the router for Vue 3 and which lives in the vuejs/router repository. The difference is not a version bump. Vue Router 4 is built for Vue 3's application instance and composition API, so installation and instance creation follow Vue 3 conventions rather than the Vue.use plugin call used with this package. If your project can move to Vue 3, Vue Router 4 is the destination, and the README's pointer exists precisely to send you there.

A different kind of alternative is unplugin-vue-router, which people also search for alongside this project. The distinction is in where the route table comes from. With vue-router, you write the routes array by hand, and the examples in this repository all follow that pattern. A file-based router derives route records from the filesystem layout instead, so the directory structure is the source of truth and the route table is generated. That approach trades explicit control over paths and names for less boilerplate and a structural convention you have to follow. Which one fits depends on whether you want route definitions to be reviewable in one file or inferred from where components live.

## Maintenance cost, release process, and the MIT licence

Upgrading within the 3.x line is a version pin away, and the CHANGELOG.md at the repository root documents changes per release. The README's own release section describes the maintainer workflow: run the tests, build the dist files with a VERSION variable, generate the changelog, commit the dist directory, publish with npm version, push the tag, and publish to npm. That last detail matters for consumers. The dist files are committed to the repository and the package's files array ships src, dist/*.js, dist/*.mjs, types/*.d.ts, the composables artifacts, and the vetur files. You are installing a package whose main, module, and exports fields point at prebuilt bundles, so the build toolchain of the repository is not something you inherit.

The licence is MIT, Copyright (c) 2013-present Evan You, as stated in the README and in package.json. MIT permits commercial use and modification provided the copyright notice and permission notice are retained. That is the extent of what the repository supports; questions about your own distribution obligations belong with your legal counsel, not with a README.

The practical maintenance cost of staying on this router is not the upgrade. It is the absence of upstream fixes. A bug you hit in v3.6.5 has no scheduled release to land in, and the README directs support questions to the Discord chat server or the official forum while reserving the issue list for bug reports and feature requests. Budget for the possibility that you fix things yourself.

## Conclusion

Adopt vue-router 3 only inside an existing Vue 2 codebase that cannot move yet, and pin the version deliberately: the README says Vue 2 and this router have reached end of life, and the newest published release is v3.6.5 from 2022-09-06. If you are starting something new, go to vuejs/router for Vue 3 instead. Before committing, verify three things in your own code: that no route depends on the removed named-route params behaviour, whether your app needs the composables entry point, and what your bundler resolves from the package exports map.

## FAQ

### What is vue-router used for?

It is the official router for Vue 2, mapping URL paths to components and keeping the address bar in step with the rendered view. The README states that it works only with Vue 2.0, and that both have reached end of life.

### How do I install vue-router?

The package is published on npm as vue-router, so you install it into a Vue 2 project alongside Vue itself. The README then points to the documentation at v3.router.vuejs.org for getting started.

### How do I set up vue-router in a Vue 2 app?

You create a router instance with a routes array and pass it to the root Vue instance. The README's development setup shows yarn, yarn build, and yarn dev to serve the bundled examples at localhost:8080 if you want to run them first.

### What is the alternative to vue-router 3?

The README names Vue Router 4, in the vuejs/router repository, as the router for Vue 3. It is a separate codebase built for Vue 3 rather than a newer version of this package.

### How do I use vue-router in a component?

The repository keeps separate example folders for router-link, router.push, navigation-guards and route-params, which cover declarative links, programmatic navigation, guards and parameter handling. The README points to the examples directory and to the documentation site for the details.

## Sources

- [License: MIT](https://github.com/vuejs/vue-router/blob/dev/LICENSE)
- [Project website](http://v3.router.vuejs.org/)
- [README](https://github.com/vuejs/vue-router/blob/dev/README.md)
- [Releases](https://github.com/vuejs/vue-router/releases)
- [vuejs/vue-router on GitHub](https://github.com/vuejs/vue-router)

---

Hysen Labs editorial analysis, written from the project's own repository and release notes. Cite the canonical page: https://hysenlabs.com/projects/vuejs-vue-router
