DEV Community

Discussion on: Using Modules and Pinia to structure Nuxt 3 app

Collapse
 
andyjamesn profile image
andyjamesn

Does this method still work on the latest 3.0.0-rc.3

I am getting the following error. I have reproduced it with identical code as described in this tutorial.

ERROR Cannot restart nuxt: Nuxt module should be a function: [object Object] 15:05:41

at normalizeModule (/Users/A/FlowR/ui-kit-repos/flowr-app/node_modules/@nuxt/kit/dist/index.mjs:417:11)
at installModule (/Users/A/FlowR/ui-kit-repos/flowr-app/node_modules/@nuxt/kit/dist/index.mjs:397:47)
at initNuxt (/Users/A/FlowR/ui-kit-repos/flowr-app/node_modules/nuxt/dist/index.mjs:1336:13)
at async load (/Users/A/FlowR/ui-kit-repos/flowr-app/node_modules/nuxi/dist/chunks/dev.mjs:6734:9)
at async _applyPromised (/Users/A/FlowR/ui-kit-repos/flowr-app/node_modules/nuxi/dist/chunks/dev.mjs:6686:10)

Collapse
 
jacobandrewsky profile image
Jakub Andrzejewski

Hey,

I wrote this article some time ago and the structure of nuxt.config.ts file changed a bit. Basically if you have a nuxt 3 rc.3 project the only thing you have to change is from buildModules to modules and do not use object syntax to define a local module but just use a path i.e.

  modules: [
    '@pinia/nuxt',
    '~/modules/blog/module'
  ]
Enter fullscreen mode Exit fullscreen mode

Thans for noticing that. I will update the article to be up to date :)

Collapse
 
andyjamesn profile image
andyjamesn

Thanks, I managed to work it out by looking at the git repository you linked to in your article.

One other thing worth mentioning is I had to do was yarn add @nuxt/kit