Nuxt configuration is not working for Nuxt2.x (Cannot find module '#app')
See original GitHub issueSays in documentation that plugin works in Nuxt 2, but example in documentation is not working.
`TS2307: Cannot find module ‘#app’ or its corresponding type declarations. 1 | import { createNuxtPersistedState } from ‘pinia-plugin-persistedstate’
2 | import { defineNuxtPlugin, useCookie } from ‘#app’ | ^^^^^^ 3 | 4 | export default defineNuxtPlugin(nuxtApp => { 5 | nuxtApp.$pinia.use(createNuxtPersistedState(useCookie))`
Removing this line and trying to do correct import statements, will lead to errors for useCookie(not found)
Issue Analytics
- State:
- Created a year ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Cannot start nuxt: Cannot find module 'nuxt' #3060 - GitHub
Nuxt CLI v3.0.0-27398533.8edd481 > Local: http://localhost:3000/ ERROR Cannot start nuxt: Cannot find module 'nuxt' Require stack: - /nuxt3-app/index.js.
Read more >Configuration - Nuxt
Nuxt lets you define the CSS files/modules/libraries you want to set globally (included in every page). In case you want to use sass...
Read more >Nuxt configuration file
Nuxt configuration file. By default, Nuxt is configured to cover most use cases. This default configuration can be overwritten with the nuxt.config.js file....
Read more >Installation - Nuxt
Here, you will find information on setting up and running a Nuxt project in 4 steps. ... To get started quickly, you can...
Read more >Installation | Nuxt Image
Using image module in your Nuxt project is only one command away. ... Add the module to buildModules in your nuxt.config : nuxt.config.js...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’m not sure about Cookies, but I hope this helps for Nuxt 2:
plugins/persistedStatePlugin.js
nuxt.config.js
name your file
plugins/persistedStatePlugin.client.js
to make it clientside only, that way it won’t try to access to localStorage while server side rendering