You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 6, 2023. It is now read-only.
You can use [composables](/guide/directory-structure/composables) within Nuxt plugins:
45
+
46
+
```ts
47
+
exportdefaultdefineNuxtPlugin((NuxtApp) => {
48
+
const foo =useFoo()
49
+
})
50
+
```
51
+
52
+
However, keep in mind there are some limitations and differences:
53
+
54
+
**If a composable depends on another plugin registered later, it might not work.**
55
+
56
+
**Reason:** Plugins are called in order sequencially and before everything else. You might use a composable that dependants on another plugin which is not called yet.
57
+
58
+
**If a composable depends on the Vue.js lifecycle, it won't work.**
59
+
60
+
**Reason:** Normally, Vue.js composables are bound to the current component instance while plugins are only bound to `nuxtApp` instance.
61
+
42
62
## Automatically Providing Helpers
43
63
44
64
If you would like to provide a helper on the `NuxtApp` instance, return it from the plugin under a `provide` key. For example:
0 commit comments