diff --git a/src/module.js b/src/module.js index 4df716e18d..3ad4ccaa87 100644 --- a/src/module.js +++ b/src/module.js @@ -10,7 +10,6 @@ import { import { getCrossorigin } from './runtime/utils'; import FontConfig from './runtime/classes/FontConfig'; import { - DEFAULT_TARGET_FORMATS, MODULE_NAME, addNuxtFontaine, addNuxtImage, @@ -176,8 +175,9 @@ async function addModules(nuxt, moduleOptions) { await addNuxtFontaine(nuxt); } if (!moduleOptions.disableNuxtImage) { - moduleOptions.targetFormats = - moduleOptions.targetFormats || DEFAULT_TARGET_FORMATS; + if (!moduleOptions.targetFormats?.length) { + moduleOptions.targetFormats = ['webp', 'avif', 'jpg|jpeg|png|gif']; + } await addNuxtImage(nuxt); } } diff --git a/src/utils.js b/src/utils.js index de1af078cd..a29959ebf4 100644 --- a/src/utils.js +++ b/src/utils.js @@ -1,8 +1,6 @@ import { defu } from 'defu'; import { installModule, useLogger } from '@nuxt/kit'; -export const DEFAULT_TARGET_FORMATS = ['webp', 'avif', 'jpg|jpeg|png|gif']; - export const MODULE_NAME = 'nuxt-booster'; export const logger = useLogger(MODULE_NAME); diff --git a/src/utils/options.js b/src/utils/options.js index 736a07867d..9b3379381c 100644 --- a/src/utils/options.js +++ b/src/utils/options.js @@ -26,7 +26,7 @@ export function getDefaultOptions() { fonts: [], - targetFormats: undefined, + targetFormats: [], densities: 'x1 x2', /**