Skip to content

Commit 57d8727

Browse files
docs: expand installation.md (#2071)
1 parent 1bbf2a9 commit 57d8727

File tree

1 file changed

+37
-5
lines changed

1 file changed

+37
-5
lines changed

packages/docs/installation.md

Lines changed: 37 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,46 @@
1212

1313
<!--/email_off-->
1414

15-
## npm
15+
This will expose Vue Router via a global `VueRouter` object, e.g. `VueRouter.createRouter(...)`.
1616

17-
```bash
17+
## Package managers
18+
19+
If you have an existing project that uses a JavaScript package manager, you can install Vue Router from the npm registry:
20+
21+
::: code-group
22+
23+
```bash [npm]
1824
npm install vue-router@4
1925
```
2026

21-
## yarn
22-
23-
```bash
27+
```bash [yarn]
2428
yarn add vue-router@4
2529
```
30+
31+
```bash [pnpm]
32+
pnpm add vue-router@4
33+
```
34+
35+
:::
36+
37+
If you're starting a new project, you might find it easier to use the [create-vue](https://github.com/vuejs/create-vue) scaffolding tool, which creates a Vite-based project with the option to include Vue Router:
38+
39+
::: code-group
40+
41+
```bash [npm]
42+
npm create vue@latest
43+
```
44+
45+
```bash [yarn]
46+
yarn create vue
47+
```
48+
49+
```bash [pnpm]
50+
pnpm create vue
51+
```
52+
53+
:::
54+
55+
You'll be prompted with some questions about the kind of project you want to create. If you choose to install Vue Router, the example application will also demonstrate some of Vue Router's core features.
56+
57+
Projects using package managers will typically use ES modules to access Vue Router, e.g. `import { createRouter } from 'vue-router'`.

0 commit comments

Comments
 (0)