From a88d3f3ccdb73d84e6e649fc1a06dd1ffbc347d7 Mon Sep 17 00:00:00 2001 From: JD Solanki Date: Thu, 10 Aug 2023 14:13:39 +0530 Subject: [PATCH] docs: mention adding auto-import of third party packages (#22575) --- docs/2.guide/1.concepts/1.auto-imports.md | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/docs/2.guide/1.concepts/1.auto-imports.md b/docs/2.guide/1.concepts/1.auto-imports.md index 3b3c8f157..572ea66fc 100644 --- a/docs/2.guide/1.concepts/1.auto-imports.md +++ b/docs/2.guide/1.concepts/1.auto-imports.md @@ -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'] + } + ] + } +}) +```