Question: defineNuxtPlugin access old context.req
See original GitHub issueEnvironment
- Operating System:
Darwin
- Node Version:
v16.15.0
- Nuxt Version:
3.0.0-rc.3
- Package Manager:
pnpm@7.1.3
- Builder:
vite
- User Config:
srcDir
,css
,build
,vite
- Runtime Modules:
-
- Build Modules:
-
Reproduction
import { defineNuxtPlugin } from "#app"
export default defineNuxtPlugin((nuxtApp) => {
console.log(nuxtApp) // doesn't have context or context.req
})
Describe the bug
Creating a plugin on nuxt 2 i only use
export default (context) => {
console.log(context.req) //here i can access context.req
}
How can I get context.req if i also need to use defineNuxtPlugin((nuxtApp)) ?
Thank you for the help
Additional context
No response
Logs
No response
Issue Analytics
- State:
- Created a year ago
- Comments:8 (4 by maintainers)
Top Results From Across the Web
Nuxt.js3 plugin's context becomes undefined - Stack Overflow
Please import useRuntimeConfig from '#app' . So in your example change the first line: import { defineNuxtPlugin } from '#app'. Into:
Read more >The context - Nuxt
The context provides additional objects/params from Nuxt to Vue components and is available in special nuxt lifecycle areas.
Read more >Nuxt Context: where is it in Nuxt 3 - Krutie Patel
In Nuxt 2, res and req objects are available through the context object only on server-side. ... In Nuxt 3, we have a...
Read more >Creating Server-side Rendered Vue.js Apps Using Nuxt.js
On the Context, we can access the req object, which stores all the headers and other information from the client request. (This will...
Read more >Working with context, helpers, and advanced properties in ...
The Nuxt context is an additional collection of data about the current ... when they do not meet the requirements to access certain...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thank you @danielroe, you are a lifesaver.
Oh i’m getting your point now, I’m so sorry, i have overlooked this issue. 😀 As always, you are a lifesaver. Thank you so much