gatsby-plugin-dark-mode
gatsby-plugin-dark-mode copied to clipboard
TypeError: window.__setPreferredTheme is not a function
Steps to reproduce:
-
gatsby new gatsby-blog
-
npm install gatsby-plugin-dark-mode
- Copied the ThemeToggler code from documentation.
- Added Component to index.js
- Clicking on the generated checkbox produces error.
File:
toggleTheme node_modules/gatsby-plugin-dark-mode/ThemeToggler.js:54
Did you forget to include the plugin in your gatsby-config.js
?
I got the same error. Restarting my local dev server fixed it for me.
Sadly I have the same issue:
- restarted dev server,
- removed options from plugin initialization,
- cleared cache and started server again.
Still the same, crashes when clicking the checkbox.
I had the same error, but it was fixed by adding "--save" to the npm command. So to install the plugin, I used:
npm install gatsby-plugin-dark-mode --save
Did you forget to include the plugin in your
gatsby-config.js
?
yeah, this works fine.