Git Product home page Git Product logo

Comments (13)

farnabaz avatar farnabaz commented on July 28, 2024 2

@gimyboya Using [email protected] + nuxt-storybook > 4.0.0 should work without any issues.

New versions of module is not compatible with Storybook because it uses vue-renderer hook to inject script and nuxt-storybook does not support renderer hooks. https://github.com/nuxt-community/color-mode-module/blob/master/lib/module.js#L31

from color-mode.

Atinux avatar Atinux commented on July 28, 2024 1

Hi @kgnfth

Please use 2.0.8, small mistake sorry about this.

from color-mode.

BennaceurHichem avatar BennaceurHichem commented on July 28, 2024 1

Yes I did, I was workinf with 2.0.10, then I downgrade and same thing. This error was gone when I applied what @ManUtopiK mention

from color-mode.

Atinux avatar Atinux commented on July 28, 2024 1

cc @danielroe on it too

from color-mode.

Atinux avatar Atinux commented on July 28, 2024

@farnabaz do you mind checking when you have 5 min?

from color-mode.

ManUtopiK avatar ManUtopiK commented on July 28, 2024

I think I just fixed this issue, but I made many change on the storybook config, so I'm not sure how I did...
I set a custom storybook config as explained here.

But maybe it's work just only with this file .storybook/preview-head.html:

<script>
  var data = {}
  window['__NUXT_COLOR_MODE__'] = {
    preference: 'light',
  }
</script>

from color-mode.

farnabaz avatar farnabaz commented on July 28, 2024

@nuxtjs/storybook executes plugin scripts after the plugin import and this cause the issue. And color-mode uses global variable on import. The leads to undefined error.

from color-mode.

kgnfth avatar kgnfth commented on July 28, 2024

@Atinux i have the same issue after upgrading from 2.0.5 to 2.0.7

my settings is
nuxt.config.js

colorMode: {
  storageKey: 'color-mode',
  preference: 'system',
  fallback: 'dark',
  classSuffix: '',
}

and in my tailwind.config.js i have

darkMode: 'class'

from color-mode.

kgnfth avatar kgnfth commented on July 28, 2024

Hi @kgnfth

Please use 2.0.8, small mistake sorry about this.

Thx it works 💙

from color-mode.

BennaceurHichem avatar BennaceurHichem commented on July 28, 2024

I'm having the same problem, I used the 2.0.8 version but the error still occurs in Storybook, any idea?

from color-mode.

Atinux avatar Atinux commented on July 28, 2024

Did you try the 2.0.10?

from color-mode.

khawarizmus avatar khawarizmus commented on July 28, 2024

@Atinux is there a cleaner way as to not have to eject and keep using the module way of doing things with nuxtjs? while the solution provided by @ManUtopiK works it forces us to have the config in the .storybook folder.

from color-mode.

Atinux avatar Atinux commented on July 28, 2024

Cc @farnabaz

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.