Using Sanity for multi-country content with custom desk structure and filter references.
12 replies
Last updated: Feb 24, 2023
J
Hey! Has anyone set up the netlify deploy plugin with sanity V3? I followed the docs, but getting the error:
netlifyWidget is not a function. Wondering if there is something I'm missing here? The dashboard is set up correctly and showing in the studio, but when I add the
netlifyWidgetto the list of widgets inside the
dashboardTool, I get the error. Copying my plugins snippet to this thread:
Feb 24, 2023, 8:48 PM
J
plugins: [ dashboardTool({ widgets: [ netlifyWidget({ title: 'My Netlify deploys', sites: [] }) ] }), deskTool({ structure: deskStructure }), visionTool() ],
Feb 24, 2023, 8:48 PM
J
sounds like netlifyWidget could be undefined, i'd double check it's importing ok!
Feb 24, 2023, 9:19 PM
J
does it work in your local/dev environment?
Feb 24, 2023, 9:20 PM
J
Here's how I'm importing which I believe should be correct per the docs:
import { netlifyWidget } from "sanity-plugin-dashboard-widget-netlify";
Feb 24, 2023, 9:21 PM
J
I've also tried:
import netlifyWidget from "sanity-plugin-dashboard-widget-netlify";
Feb 24, 2023, 9:22 PM
J
It's not working in local/dev
Feb 24, 2023, 9:22 PM
Z
did you add sanity-plugin-dashboard-widget-netlify to your dependencies? is it in your package.json?
Feb 24, 2023, 10:04 PM
J
Yeah it's listed in the dependencies:
"sanity-plugin-dashboard-widget-netlify": "^2.0.1",
Feb 24, 2023, 10:11 PM
Z
if you console.log(netlifyWidget) do you get anything?
ƒ G(e2) {
var t2;
return { name: "netlify-widget", component: () => (0, import_jsx_runtime.jsx)(q, r({}, e2)), layout: null != (t2 = e2.layout) ? t2 : { width: "medium" } };
}it looks like this in my console when i log the function
Feb 24, 2023, 10:29 PM
G
After adding
"sanity-plugin-dashboard-widget-netlify": "^2.0.1",to your dependencies in package.json, did you run
npm i/
yarnto install it (and if so, did it install without errors)? That error is consistent with being on version 1 of the dashboard-widget-netlify plugin. Could you please check your lock file (you can search for
sanity-plugin-dashboard-widget-netlify) to confirm you’re on
v2.0.1and not
v1.3.2?
Feb 24, 2023, 10:51 PM
J
sometimes a good ol'
rimraf node_modulesthen reinstall your packages helps
Feb 24, 2023, 10:53 PM
J
Ahh yeah okay I deleted
node_modulesand ran
yarnwhich fixed it. Thanks everyone!
Feb 24, 2023, 10:56 PM
Sanity.io – build remarkable experiences at scale
Sanity is a customizable solution that treats content as data to power your digital business. Free to get started, and pay-as-you-go on all plans.