Skip to content

Commit

Permalink
fix: hotfix to use backwards-compatible imports
Browse files Browse the repository at this point in the history
closes #64
  • Loading branch information
danielroe committed Jan 18, 2021
1 parent 0a53f91 commit f36a3c4
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 13 deletions.
2 changes: 1 addition & 1 deletion docs/content/en/helpers/images.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ You may wish to import `SanityImage` only in the components that need it, if you
</template>
<script>
import { SanityImage } from '@nuxtjs/sanity/sanity-image'
import { SanityImage } from '@nuxtjs/sanity/dist/components/sanity-image'
export default {
components: { SanityImage },
Expand Down
2 changes: 1 addition & 1 deletion docs/content/en/helpers/portable-text.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ You may wish to import `SanityContent` only in the components that need it if yo
</template>
<script>
import { SanityContent } from '@nuxtjs/sanity/sanity-content'
import { SanityContent } from '@nuxtjs/sanity/dist/components/sanity-content'
export default {
components: { SanityContent },
Expand Down
14 changes: 6 additions & 8 deletions example/nuxt.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,12 @@ const config = {
},
build: {
extend (config) {
config.resolve.alias['@nuxtjs/sanity/sanity-content'] = resolve(
__dirname,
'../src/components/sanity-content',
)
config.resolve.alias['@nuxtjs/sanity/sanity-image'] = resolve(
__dirname,
'../src/components/sanity-image',
)
config.resolve.alias[
'@nuxtjs/sanity/dist/components/sanity-content'
] = resolve(__dirname, '../src/components/sanity-content')
config.resolve.alias[
'@nuxtjs/sanity/dist/components/sanity-image'
] = resolve(__dirname, '../src/components/sanity-image')
config.resolve.alias['@nuxtjs/sanity'] = resolve(
__dirname,
'../src/index.ts',
Expand Down
2 changes: 1 addition & 1 deletion example/pages/movie/_slug.vue
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
<script lang="ts">
import Vue from 'vue'
import { groq } from '@nuxtjs/sanity'
import { SanityImage } from '@nuxtjs/sanity/sanity-image'
import { SanityImage } from '@nuxtjs/sanity/dist/components/sanity-image'
const query = groq`*[_type == "movie" && slug.current == $slug][0] {
title,
Expand Down
4 changes: 2 additions & 2 deletions templates/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ import defu from 'defu'
%>

<% if (options.components.imageHelper && !options.components.autoregister) { %>
import { SanityImage } from '@nuxtjs/sanity/sanity-image'
import { SanityImage } from '@nuxtjs/sanity/dist/components/sanity-image'
Vue.component('SanityImage', SanityImage)
<% } %>

<% if (options.components.contentHelper && !options.components.autoregister) { %>
import { SanityContent } from '@nuxtjs/sanity/sanity-content'
import { SanityContent } from '@nuxtjs/sanity/dist/components/sanity-content'
Vue.component('SanityContent', SanityContent)
<% } %>

Expand Down

0 comments on commit f36a3c4

Please sign in to comment.