next-optimized-images-canary
Version:
Automatically optimize images used in next.js projects (jpeg, png, gif, svg).
41 lines (40 loc) • 1.04 kB
TypeScript
interface WebpackConfig {
module: {
rules: {
test: RegExp;
use?: Record<string, unknown>[];
oneOf?: {
test: RegExp;
use?: {
options: {
name: string;
};
};
include?: RegExp[];
exclude?: RegExp[];
issuer?: {
test: RegExp;
};
}[];
}[];
};
}
/**
* Configure webpack and next.js to handle and optimize images with this plugin.
*/
declare const withOptimizedImages: (imageConfig: {
cacheFolder: string;
}) => (nextConfig?: {
images?: {
handleImages?: string[];
};
assetPrefix?: string;
webpack?: unknown;
}) => {
webpack(config: WebpackConfig, options: Record<string, unknown>): any;
images?: {
handleImages?: string[] | undefined;
} | undefined;
assetPrefix?: string | undefined;
};
export default withOptimizedImages;