Comments (6)
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.
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.
Can you please create a reproduction on CodeSandBox? I cannot reproduce the bug.
from color-mode.
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.
Thank you!
from color-mode.
its work thank you!
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.