Closed przemo246 closed 1 year ago
Same here, looks to be a problem with the yoast dependency
When I tested thie Beta I did it inside of a Next.js app, which allowed it to work.
In Vite it turns out it needs a little assistance...
// ./sanity.cli.ts
import {defineCliConfig} from 'sanity/cli'
// yarn add -D vite-plugin-node-polyfills
import {nodePolyfills} from 'vite-plugin-node-polyfills'
export default defineCliConfig({
// ... your project's `api` config
vite: (prev) => ({
...prev,
plugins: [
...prev.plugins,
nodePolyfills({ util: true }),
],
define: {
...prev.define,
'process.env': {},
},
}),
})
Thank you @SimeonGriggs, unfortunately, this leads to another issue connected to styled-components:
Uncaught error: Cannot read properties of undefined (reading 'REACT_APP_SC_ATTR')
http://localhost:3333/node_modules/.sanity/vite/deps/chunk-PMYGOITV.js?v=6f010646:28179:55
TypeError: Cannot read properties of undefined (reading 'REACT_APP_SC_ATTR')
at http://localhost:3333/node_modules/.sanity/vite/deps/chunk-PMYGOITV.js?v=6f010646:28179:55
I have found the following code snippet from styled-components which is leading to that problem:
export const SC_ATTR: string =
(typeof process !== 'undefined' && typeof process.env !== 'undefined' && (process.env.REACT_APP_SC_ATTR || process.env.SC_ATTR)) ||
'data-styled';
So far I haven't found any working solution to that 😥
I put some more instructions into the readme, I've updated the comment above with the more complete code example...
Thank you @SimeonGriggs! Seems to be working now!
Hey, I am using Sanity
3.2.5
and installed the latestsanity-plugin-seo-pane
however I am not able to make it work. I tried on a currently run company project and on a clean Sanity installation. I am getting the same error in both cases:deskStructure.js
file is as follows:Can you please let me know what I am doing wrong here? Are there any full examples available to compare?