nuxt-modules / color-mode

Dark and Light mode with auto detection made easy with Nuxt 🌗
https://color-mode.nuxtjs.org
MIT License
1.09k stars 101 forks source link

When SSR: false, color-mode not working #143

Closed franmellanutritienda closed 2 years ago

franmellanutritienda commented 2 years ago

Version

@nuxtjs/color-mode: 3.0.2 nuxt: 3.0.0-rc.2

Reproduction Link

Steps to reproduce

What is Expected?

What is actually happening?

Cannot read properties of undefined (reading 'preference')

at http://localhost:3000/_nuxt/node_modules/@nuxtjs/color-mode/dist/runtime/plugin.client.mjs:8:24 at useState (http://localhost:3000/_nuxt/node_modules/nuxt/dist/app/composables/state.mjs:7:26) at http://localhost:3000/_nuxt/node_modules/@nuxtjs/color-mode/dist/runtime/plugin.client.mjs:7:21 at fn (http://localhost:3000/_nuxt/node_modules/nuxt/dist/app/nuxt.mjs:106:27) at callWithNuxt (http://localhost:3000/_nuxt/node_modules/nuxt/dist/app/nuxt.mjs:111:12) at applyPlugin (http://localhost:3000/_nuxt/node_modules/nuxt/dist/app/nuxt.mjs:68:29) at applyPlugins (http://localhost:3000/_nuxt/node_modules/nuxt/dist/app/nuxt.mjs:77:11) at async initApp (http://localhost:3000/_nuxt/entry.mjs:44:7)

cdowning commented 2 years ago

I am also experiencing this issue.

jsegars commented 2 years ago

I believe this is related to a change in Nuxt shortly before the RC where a Nitro hook was removed. It is mentioned in the PR #139 but there's not any code to fix it yet.