Comments (13)
@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.
Hi @kgnfth
Please use 2.0.8
, small mistake sorry about this.
from color-mode.
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.
cc @danielroe on it too
from color-mode.
@farnabaz do you mind checking when you have 5 min?
from color-mode.
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.
@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.
@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.
Hi @kgnfth
Please use
2.0.8
, small mistake sorry about this.
Thx it works 💙
from color-mode.
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.
Did you try the 2.0.10
?
from color-mode.
@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.
Cc @farnabaz
from color-mode.
Related Issues (20)
- Dark theme cannot be loaded
- allow disabling css transitions while changing color scheme
- Get color-theme while server render HOT 2
- Forced color mode incorrect timing
- Adding class "theme-red" to <html> breaks color-mode
- Load color-mode already in spa template
- helper.getColorScheme is not a function error when trying to use the module HOT 7
- Can I use only data value?
- Selected Color dosn't save on LocalStorage
- Question about demo asset regarding license HOT 2
- On light mode background-color is transparent HOT 1
- Document how to force color mode dynamically (e.g. from a useFetch response) HOT 6
- Color of element stuck in 1 color.
- Reactive `useColorMode()` value HOT 1
- tailwind module integration breaks dark mode HOT 7
- Support set html attribute HOT 1
- Why is my nuxt app color mode configuration not working with the "prefrence : light" ? HOT 3
- Should there be a way to force a color mode in the root of the app?
- How to set a theme in arc design
- feat: link script in head for CSP 'self' compliance in v3 HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from color-mode.