Code Monkey home page Code Monkey logo

Comments (6)

Atinux avatar Atinux commented on July 22, 2024 10

Hi @allezxandre

I found the issue, if you use ssr: false and nuxt start, you need to move @nuxtjs/color-mode from buildModules to modules.

This way, the script injecting window.__NUXT_COLOR_MODE__ can be injected at runtime.

I updated the README to cover this use case, thank you for reporting it 💚

from color-mode.

hut-a-massmediagroup-100 avatar hut-a-massmediagroup-100 commented on July 22, 2024

The first time, where i caused this error, was, when i updated more part of plugins/modules(nuxt and color-mode too). Then i did rollback to the previous version of nuxt and color-mode, and that dropped error. But i wanna use fresh releases)

from color-mode.

Atinux avatar Atinux commented on July 22, 2024

Hi @hut-a-massmediagroup-100

Can you please create a reproduction on CodeSandBox? I cannot reproduce the bug.

from color-mode.

allezxandre avatar allezxandre commented on July 22, 2024

I'm not the OP, but this issue also happens to me when I enable modern mode on a SPA-mode (ssr set to false) Nuxt-TypeScript project and then use nuxt-ts generate -m. The issue is resolved if I don't use modern mode to generate the code. Edit: actually, it is not

Unfortunately I have been unable to create a reproduction on the JS CodeSandBox (here is my failed attempt).

However, I have been able to find the culprit in the following "compiled" code:

// [...]
    c.a.component('ColorScheme', Dr);
    var Ar = JSON.parse('{"path":"/","sameSite":"lax"}'),
    Nr = window.__NUXT_COLOR_MODE__,
    Mr = function (r, o) {
      var data = r.nuxtState.colorMode;
      data || (data = {
        preference: Nr.preference,
        value: Nr.value,
        unknown: 'system' === Nr.preference
      });
// [...]

Nr apparently is undefined, which might indicate that the evaluation of window.__NUXT_COLOR_MODE__ failed. I hope this helps.

from color-mode.

allezxandre avatar allezxandre commented on July 22, 2024

Thank you!

from color-mode.

rezaansarirad avatar rezaansarirad commented on July 22, 2024

its work thank you!

from color-mode.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.