Skip to content

Commit

Permalink
fix: use nuxt resolver to suppress warnings about missing dependency
Browse files Browse the repository at this point in the history
closes #33
  • Loading branch information
danielroe committed Jan 17, 2021
1 parent 1af262e commit b0d7222
Showing 1 changed file with 1 addition and 19 deletions.
20 changes: 1 addition & 19 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ const nuxtModule: Module<SanityModuleOptions> = function (moduleOptions) {

try {
if (!options.minimal) {
options.minimal = !((process.client || process.server) ? /* istanbul ignore next */ require.resolveWeak('@sanity/client') : require('@sanity/client'))
options.minimal = !this.nuxt.resolver.requireModule('@sanity/client')
}
} catch {
options.minimal = true
Expand Down Expand Up @@ -144,24 +144,6 @@ const nuxtModule: Module<SanityModuleOptions> = function (moduleOptions) {
},
})

if (options.imageHelper && !autoregister) {
this.addTemplate({
src: resolve(__dirname, '../dist/components/sanity-image.js'),
fileName: 'sanity/components/sanity-image.js',
options: {
projectId: options.projectId,
dataset: options.dataset,
},
})
}

if (options.contentHelper && !autoregister) {
this.addTemplate({
src: resolve(__dirname, '../dist/components/sanity-content.js'),
fileName: 'sanity/components/sanity-content.js',
})
}

if (autoregister) {
this.nuxt.hook('components:dirs', (dirs: string[]) => {
dirs.push(resolve(__dirname, './components'))
Expand Down

0 comments on commit b0d7222

Please sign in to comment.