Skip to content

v1.0.0

Compare
Choose a tag to compare
@danielroe danielroe released this 17 Feb 12:48
· 824 commits to main since this release

1.0.0 (2022-02-17)

Features

  • migrate module to support nuxt3 and bridge (#316) (2ec11d6)

πŸ‘‰ Migration

v1 of @nuxtjs/sanity requires either Nuxt Bridge or Nuxt 3. (If you are using Nuxt 2 without Bridge, you should continue to use v0.10.)

  1. The main change between Nuxt 2 -> Nuxt 3 is that there is no longer a globally available $sanity helper. If you want to keep the current behaviour, just enable the globalHelper option:

      import { defineNuxtConfig } from 'nuxt3'
    
      export default defineNuxtConfig({
        modules: ['@nuxtjs/sanity']
        sanity: {
    +     globalHelper: true
        }
      })
  2. Instead of adding @nuxtjs/sanity/module you will add @nuxtjs/sanity in your nuxt.config

      import { defineNuxtConfig } from 'nuxt3'
    
      export default defineNuxtConfig({
    -   modules: ['@nuxtjs/sanity/module']
    +   modules: ['@nuxtjs/sanity']
      })
  3. You should no longer import helpers like groq directly from @nuxtjs/sanity. These will be available automatically throughout your app using the Nuxt auto-imports feature. If you do need to import them directly you can do so by importing from #imports.

      import { groq, useSanity, useSanityQuery } from '#imports'
  4. If you are using <SanityContent> this now no longer renders a wrapper container. If you need the wrapper, you can add it yourself.

      <template>
    -   <SanityContent :blocks="blocks" />
    +   <div>
    +     <SanityContent :blocks="blocks" />
    +   </div>
      </template>