Skip to content

Commit

Permalink
fix: don't overwrite provided options
Browse files Browse the repository at this point in the history
  • Loading branch information
danielroe committed Feb 20, 2022
1 parent 4270c2b commit e0263e6
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export default defineNuxtModule<SanityModuleOptions>({
}

// Final resolved configuration
nuxt.options.publicRuntimeConfig.sanity = options = defu(nuxt.options.publicRuntimeConfig.sanity, {
const { projectId, dataset } = nuxt.options.publicRuntimeConfig.sanity = defu(nuxt.options.publicRuntimeConfig.sanity, {
useCdn: options.useCdn,
projectId: options.projectId,
dataset: options.dataset,
Expand All @@ -88,10 +88,10 @@ export default defineNuxtModule<SanityModuleOptions>({
additionalClients: options.additionalClients,
})

if (!options.projectId) {
if (!projectId) {
logger.warn(`No Sanity project found. Make sure you specify a ${chalk.bold('projectId')} in your Sanity config.`)
} else {
logger.info(`Running with Sanity project ${chalk.bold(options.projectId)} (${chalk.bold(options.dataset)}).`)
logger.info(`Running with Sanity project ${chalk.bold(projectId)} (${chalk.bold(dataset)}).`)
}

const runtimeDir = fileURLToPath(new URL('./runtime', import.meta.url))
Expand Down

0 comments on commit e0263e6

Please sign in to comment.