]> git.ipfire.org Git - thirdparty/vuejs/router.git/commitdiff
docs: expand installation.md (#2071)
authorskirtle <65301168+skirtles-code@users.noreply.github.com>
Fri, 15 Dec 2023 06:14:29 +0000 (06:14 +0000)
committerGitHub <noreply@github.com>
Fri, 15 Dec 2023 06:14:29 +0000 (07:14 +0100)
packages/docs/installation.md

index 5503d5cebc0dbdeb1cf13b257eff58815ef21f52..6677e33b8b8148d393c3691611cb4f50b7312575 100644 (file)
 
 <!--/email_off-->
 
-## npm
+This will expose Vue Router via a global `VueRouter` object, e.g. `VueRouter.createRouter(...)`.
 
-```bash
+## Package managers
+
+If you have an existing project that uses a JavaScript package manager, you can install Vue Router from the npm registry:
+
+::: code-group
+
+```bash [npm]
 npm install vue-router@4
 ```
 
-## yarn
-
-```bash
+```bash [yarn]
 yarn add vue-router@4
 ```
+
+```bash [pnpm]
+pnpm add vue-router@4
+```
+
+:::
+
+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:
+
+::: code-group
+
+```bash [npm]
+npm create vue@latest
+```
+
+```bash [yarn]
+yarn create vue
+```
+
+```bash [pnpm]
+pnpm create vue
+```
+
+:::
+
+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.
+
+Projects using package managers will typically use ES modules to access Vue Router, e.g. `import { createRouter } from 'vue-router'`.
\ No newline at end of file