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
Attempting to access the logger in server/api returns undefined but using const {$logger} = useNuxtApp() in client works. I can go to localhost:3000 after running npm run dev and load it without errors. The plugin provided used the information in the documentation so what am I missing? I thought I could simply be able to access the logger in the client using this.$logger without useNuxtApp but that does not work. I am unable to access the logger in the event handler which always returns undefined
Additional context
Unfortunately, I cannot provide the published plugin because it is in a private npm repo. I can access it with npm i cd-logger --save-prod and include it as a module without errors so it is difficult to understand why it is undefined when there are no errors. When I run 'npm run prepack' the node_modules is @nuxt/kit is included, is included in the published module. Is that expected?
Can I use addServerPlugin, and if so how do I reference the logger in the plugin?
Logs
No response
The text was updated successfully, but these errors were encountered:
Environment
Environment
Operating System: Mac OS Ventura
Node Version: v20.10.0
Nuxt Version: 3.10.0
Package Manager: npm@10.2.3
Reproduction
https://stackblitz.com/edit/github-bfnrsx-dxkhza?file=src%2Fplugins%2Flogger.client.ts,src%2Fplugins%2Flogger.server.ts,src%2Fmodule.ts,package.json,src%2FlogLevels.ts,playground%2Fnuxt.config.ts
Here is the configuration to access the module
I attempt to access it as follows
Describe the bug
Attempting to access the logger in server/api returns undefined but using const {$logger} = useNuxtApp() in client works. I can go to localhost:3000 after running npm run dev and load it without errors. The plugin provided used the information in the documentation so what am I missing? I thought I could simply be able to access the logger in the client using this.$logger without useNuxtApp but that does not work. I am unable to access the logger in the event handler which always returns undefined
Additional context
Unfortunately, I cannot provide the published plugin because it is in a private npm repo. I can access it with npm i cd-logger --save-prod and include it as a module without errors so it is difficult to understand why it is undefined when there are no errors. When I run 'npm run prepack' the node_modules is @nuxt/kit is included, is included in the published module. Is that expected?
Can I use addServerPlugin, and if so how do I reference the logger in the plugin?
Logs
No response
The text was updated successfully, but these errors were encountered: