-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uncaught ReferenceError: defineNuxtPlugin is not defined #360
Comments
Experiencing the same thing. |
Same thing, seems to be an issue. |
For those who curious the error is: After executing npm i nuxt-logrocket and adding config // nuxt.config.js
export default defineNuxtConfig({
modules: [
'nuxt-logrocket',
//...
],
logRocket: {
id: 'xxx',
dev: true,
config: {}
},
//...
}); Nuxt info:
|
I'm having the same issue. |
For anyone else that's stuck, this seems to work, for now. I did this quick & dirty, but if you're running Nuxt3, with the latest
import LogRocket from 'logrocket'
import type { Plugin as NuxtPlugin } from '#app'
const plugin: NuxtPlugin = defineNuxtPlugin(() => {
const { $pinia } = useNuxtApp()
const opts = useRuntimeConfig()?.public?.logRocket
if (!opts?.id || (!opts?.dev && !(process.env.NODE_ENV === 'production')))
return
LogRocket.init(opts?.id, opts?.config)
if ($pinia && opts?.enablePinia) {
$pinia.use(({ store }) => {
store.$subscribe(m => LogRocket.log('mutation', m))
})
}
return { provide: { LogRocket } }
})
export default plugin And in your runtimeConfig: {
public: {
// all options can be found here: https://www.npmjs.com/package/logrocket?activeTab=code
// dist/types.d.ts --> interface IOptions
logRocket: {
id: 'som_id/your_logrocket_appName',
dev: false, // or true if you want
enablePinia: true,
config: {},
},
},
}, Hope this helps. It's pretty much the full re-implementation of this repo's plugin...except up-to-date and properly typed. |
Just adding a comment here just so it's known that it's still an issue. I have set |
I'm getting the error as well. |
@armenr Only thing I added was LogRocket identity tracking.
|
getting the same issue |
hi @richard-edwards, can you show me how you implemented it in you nuxt.config file please? |
@aguirremac assuming you mean the user identification part .. the plugin part is the same as @armenr shows above. At the top of my
|
thank you. |
The same error happens here when adding the LogRocket module in nuxt.config.ts.
When I Look at the browser console I see an error message: |
@thiagonunesbatista - Please see the posts above. We solved this by simply reimplementing the correct code for the plugin, ourselves. Feel free to use the examples included here. They have been working for the rest of us :) |
I am running into this issue as well. It seems like the only solution currently is to rewrite defineNuxtPlugin() ? I'm running Nuxt3. Is this plugin generally still supported / active? |
I think you have to explicit import defineNuxtPlugin like you import Logrocket in the plugin
import { defineNuxtPlugin } from '#app'
The text was updated successfully, but these errors were encountered: