Has anyone ever encountered this error when using nuxt-auth from this official guide? How did you solve it? I'm stuck here for days.
The error is defu__WEBPACK_IMPORTED_MODULE_3__ is not a function
Has anyone ever encountered this error when using nuxt-auth from this official guide? How did you solve it? I'm stuck here for days.
The error is defu__WEBPACK_IMPORTED_MODULE_3__ is not a function
I had the same issue today with a freshly installed Nuxt 2.15.8 app. Once I added the @nuxtjs/auth-next v.5.0.0-1667386184.dfbbb54 to go with Laravel Sanctum providers the app crashed with same error message. After alot of searching around I found a solution to make the app work again.
In nuxt.config.js add:
build: {
transpile: [
'defu'
]
}
Hope that helps for you and others having the same issue.
Ran into a similar warning with React
early this week, It means you are trying to call a function/access a property of a module that you imported but imported wrongly or it is not exported from the module. webpack throws that error: Similar problem was:
// inside get-user.js
const getUser = () => {
const result = localStorage.getItem('user')
if(result) return JSON.parse(result)
else return null
}
// Notice: missing export
// inside App.jsx
import getUser from './get-user'
const App = () => {
const user = getUser()
}
As you can see, inside get-user.js
it slipped my mind to add an export
for the getUser
function. Webpack bundles this but fails later on when I load the App
component.
A possible cause for your issue:
next-auth
version you are using, Some libraries have breaking changes in a major release, for example, new versions of node-fetch
is shipped as ES6
module by default, suggestion is to switch to a lower version(stable) of the package.export/imports
relating to that module in your code if they are correct.Let me know if that helps, Happy coding!
© 2022 - 2024 — McMap. All rights reserved.