Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to use imagemin instead of wasm #15

Closed

Conversation

andreisergiu98
Copy link

Fixes #10

So the config is basically this:

export interface ImageminOptions {
  mozjpeg?: ImageminMozjpegOptions | boolean,
  optipng?: ImageminOptipngOptions | boolean,
  pngquant?: ImageminPngquantOptions | boolean,
}

export interface LoaderOptions {
  optimize?: boolean;
  cacheFolder?: string;
  includeStrategy?: 'string' | 'react';
  mozjpeg?: MozjpegOptions;
  oxipng?: OxipngOptions;
  webp?: WebpOptions;
  gifsicle?: GifsicleOptions;
  svgo?: Record<string, unknown>;
  svgr?: Record<string, unknown>;
  imagemin?: ImageminOptions
}

If a plugin is true or an object it will use imagemin instead of wasm for that format.
I think we should also check at start if the enabled plugins are installed since they are listed as peer dependencies, currently it will throw an error for each image if plugins are enabled and missing.

Also we can use dynamic imports like await import('imagemin-...') and allow any imagemin plugin that is available.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add an opt in option to use imagemin instead of wasm libs
1 participant