docs: mention adding auto-import of third party packages (#22575)

This commit is contained in:
JD Solanki 2023-08-10 14:13:39 +05:30 committed by GitHub
parent 26bb507a45
commit a88d3f3ccd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -140,3 +140,26 @@ export default defineNuxtConfig({
}
})
```
## Auto-import from third-party packages
Nuxt also allows auto-importing from third-party packages.
::alert
If you are using the Nuxt module for that package, it is likely that the module has already configured auto-imports for that package.
::
For example, you could enable the auto-import of the `useI18n` composable from the `vue-i18n` package like this:
```ts [nuxt.config.ts]
export default defineNuxtConfig({
imports: {
presets: [
{
from: 'vue-i18n',
imports: ['useI18n']
}
]
}
})
```