docs: auto imports don't work in server/api (#3330)

This commit is contained in:
tramplay 2022-02-21 09:36:16 -03:00 committed by GitHub
parent a358bdad93
commit ed411c687d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,6 +1,6 @@
# Auto imports
Nuxt auto-imports helper functions, composables and Vue APIs to use across your application without explicitly importing them. Based on the directory structure, every Nuxt application can also use auto-imports for its own components, composables and plugins.
Nuxt auto-imports helper functions, composables and Vue APIs to use across your application without explicitly importing them. Based on the directory structure, every Nuxt application can also use auto-imports for its own components, composables and plugins. These functions can be used in components, composables or plugins. However, auto imports don't currently work within the server scope. They just work within the Vue portion of your app.
Contrary to a classic global declaration, Nuxt preserves typings and IDEs completions and hints, and only includes what is actually used in your production code.
@ -16,8 +16,6 @@ Contrary to a classic global declaration, Nuxt preserves typings and IDEs comple
Nuxt auto-imports functions and composables to perform [data fetching](/docs/usage/data-fetching), get access to the [app context](/docs/usage/nuxt-app) and [runtime config](/docs/usage/runtime-config), manage [state](/docs/usage/state) or define components and plugins.
These functions can be used in components, composables or plugins.
```vue
<script setup>
/* useAsyncData() and $fetch() are auto-imported */