Open Raghxv11 opened 1 year ago
I am also facing the same issue. But Solve it. You have to change some modification. In vite.config.js you have to add this code:
`import { defineConfig } from 'vite' import react from '@vitejs/plugin-react'
import { config } from 'dotenv'; config();
// https://vitejs.dev/config/ export default defineConfig({ plugins: [react()], define: { 'process.env': process.env }
})`
This can fix the error
So I was getting an error in my client.js file that sanityClient is not exported from sanity/client. I figured that it was deprecated, so I used createClient instead of sanityClient:
`import { createClient } from '@sanity/client'; import { imageUrlBuilder } from '@sanity/image-url';
export const client = createClient({ projectId: process.env.REACT_APP_SANITY_PROJECT_ID, dataset: 'production', apiVersion: '2023-05-03', useCdn: true, token: process.env.REACT_APP_SANITY_TOKEN, });
const builder = imageUrlBuilder(client);
export const urlFor = (source) => builder.image(source);`
But now I am getting a TypeError: Object(...) is not a function And apparently its in node modules?
What do I do?