Skip to content

Commit

Permalink
feat: add guards to auto imports
Browse files Browse the repository at this point in the history
Close #100
  • Loading branch information
posva committed Nov 27, 2022
1 parent 9e3fdb2 commit bfbe240
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
15 changes: 15 additions & 0 deletions README.md
Expand Up @@ -181,6 +181,21 @@ If you are using [unplugin-auto-import](https://github.com/antfu/unplugin-auto-i
})
```

Note that the `vue-router` preset might export less things than the one exported by `unplugin-vue-router` so you might need to add any other imports you were relying on manually:

```diff
AutoImport({
imports: [
- 'vue-router',
+ VueRouterAutoImports,
+ {
+ // add any other imports you were relying on
+ 'vue-router/auto': ['useLink']
+ },
],
}),
```

Make sure to also check and follow [the TypeScript section](#typescript) below **if you are using TypeScript or have a `jsconfig.json` file**.

## Configuration
Expand Down
2 changes: 2 additions & 0 deletions src/index.ts
Expand Up @@ -185,6 +185,8 @@ export const VueRouterExports: Array<string | [string, string]> = [
'useRoute',
'useRouter',
'defineLoader',
'onBeforeRouteUpdate',
'onBeforeRouteLeave',
// NOTE: the typing seems broken locally, so instead we export it directly from unplugin-vue-router/runtime
// 'definePage',
]
Expand Down

0 comments on commit bfbe240

Please sign in to comment.