diff --git a/apps/example-ssr/astro.config.mjs b/apps/example-ssr/astro.config.mjs index 11ae6a36..3ce8bd08 100644 --- a/apps/example-ssr/astro.config.mjs +++ b/apps/example-ssr/astro.config.mjs @@ -1,4 +1,4 @@ -import { sanityIntegration } from '@sanity/astro' +import sanity from '@sanity/astro' import { defineConfig } from 'astro/config' import vercel from '@astrojs/vercel/serverless'; import react from '@astrojs/react'; @@ -6,7 +6,7 @@ import react from '@astrojs/react'; // https://astro.build/config export default defineConfig({ integrations: [ - sanityIntegration({ + sanity({ projectId: '3do82whm', dataset: 'next', // If you are doing static builds you may want opt out of the CDN diff --git a/apps/example/astro.config.mjs b/apps/example/astro.config.mjs index 07344ab0..7cdcef5c 100644 --- a/apps/example/astro.config.mjs +++ b/apps/example/astro.config.mjs @@ -1,11 +1,11 @@ -import { sanityIntegration } from "@sanity/astro"; +import sanity from "@sanity/astro"; import { defineConfig } from "astro/config"; import react from '@astrojs/react'; // https://astro.build/config export default defineConfig({ integrations: [ - sanityIntegration({ + sanity({ projectId: "3do82whm", dataset: "next", // If you are doing static builds you may want opt out of the CDN diff --git a/packages/sanity-astro/README.md b/packages/sanity-astro/README.md index 88a72581..e5f23407 100644 --- a/packages/sanity-astro/README.md +++ b/packages/sanity-astro/README.md @@ -46,13 +46,13 @@ You might have to restart the TS Server running in your code editor to get it to Configure the integration in your `astro.config.mjs` file. The configuration options and methods are the same as for [@sanity/client](https://github.com/sanity-io/client#readme): ```typescript -import { sanityIntegration } from "@sanity/astro"; +import sanity from "@sanity/astro"; import { defineConfig } from "astro/config"; // https://astro.build/config export default defineConfig({ integrations: [ - sanityIntegration({ + sanity({ projectId: "", dataset: "", // Set useCdn to false if you're building statically. diff --git a/packages/sanity-astro/src/index.ts b/packages/sanity-astro/src/index.ts index 07b17f78..54f462ce 100644 --- a/packages/sanity-astro/src/index.ts +++ b/packages/sanity-astro/src/index.ts @@ -11,7 +11,7 @@ const defaultOptions: IntegrationOptions = { apiVersion: "v2023-08-24", }; -export function sanityIntegration( +export default function sanityIntegration( options: IntegrationOptions, ): AstroIntegration { const resolvedOptions = { diff --git a/packages/sanity-astro/src/studio/studio-route.astro b/packages/sanity-astro/src/studio/studio-route.astro index d29bb372..d5878575 100644 --- a/packages/sanity-astro/src/studio/studio-route.astro +++ b/packages/sanity-astro/src/studio/studio-route.astro @@ -3,6 +3,8 @@ import { StudioComponent } from "./studio-component" export async function getStaticPaths() { return [{ params: { path: "admin" } }] } + +export const prerender = true ---