Skip to content

Commit

Permalink
Merge pull request #990 from basics/feature/989-targetformats-appears…
Browse files Browse the repository at this point in the history
…-to-be-an-invalid-config-prop

fix(module): integrate default targetFormats in defaults
  • Loading branch information
ThornWalli authored Apr 24, 2024
2 parents 96295dd + b8429c0 commit d2cba8a
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
6 changes: 3 additions & 3 deletions src/module.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import {
import { getCrossorigin } from './runtime/utils';
import FontConfig from './runtime/classes/FontConfig';
import {
DEFAULT_TARGET_FORMATS,
MODULE_NAME,
addNuxtFontaine,
addNuxtImage,
Expand Down Expand Up @@ -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);
}
}
2 changes: 0 additions & 2 deletions src/utils.js
Original file line number Diff line number Diff line change
@@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/utils/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export function getDefaultOptions() {

fonts: [],

targetFormats: undefined,
targetFormats: [],
densities: 'x1 x2',

/**
Expand Down

0 comments on commit d2cba8a

Please sign in to comment.