chakra-ui / chakra-ui-vue

⚡️ Build scalable and accessible Vue.js applications with ease.

Home Page:https://vue.chakra-ui.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

TypeError: defu is not a function in a fresh installation

0xcrypto opened this issue · comments

const defu = require('defu')

defu is incorrectly imported in above mentioned line and throws error in a fresh installation.

vi@vi:~/source/example-app$ npm run dev

> example-app@1.0.0 dev
> nuxt


 FATAL  defu is not a function                                                                                                                                                             18:36:00

  at module.exports (node_modules/@chakra-ui/nuxt/lib/module.js:20:32)
  at ModuleContainer.addModule (node_modules/@nuxt/core/dist/core.js:239:34)
  at node_modules/@nuxt/utils/dist/utils.js:639:43
  at async ModuleContainer.ready (node_modules/@nuxt/core/dist/core.js:55:5)
  at async Nuxt._init (node_modules/@nuxt/core/dist/core.js:478:5)


   ╭───────────────────────────────────────╮
   │                                       │
   │   ✖ Nuxt Fatal Error                  │
   │                                       │
   │   TypeError: defu is not a function   │
   │                                       │
   ╰───────────────────────────────────────╯

It needs to be destructured:

const { defu } = require('defu') // works fine

Manually installing defu@^2.0.4 works too.

Just did a fresh setup with Nuxt and I'm still getting this issue. Fixed it by editing the import.