UNPKG

1.18 kBJavaScriptView Raw
1const chalk = require('chalk');
2const figures = require('figures');
3
4const prefix = `${chalk.gray('next-optimized-images')} ${chalk.red(figures.pointer)}`;
5
6/**
7 * Output a warning when images should get optimized (prod build) but no optimization
8 * package is installed.
9 */
10const showWarning = () => console.log( // eslint-disable-line no-console
11 `${prefix} ${chalk.red('WARNING!')}
12${prefix} ${chalk.red('No package found which can optimize images.')}
13${prefix} Starting from version ${chalk.cyan('2')} of ${chalk.cyan('next-optimized-images')}, all optimization is optional and you can choose which ones you want to use.
14${prefix} For help during the setup and installation, please read ${chalk.underline('https://github.com/cyrilwanner/next-optimized-images#optimization-packages')}
15
16${prefix} If you recently ${chalk.cyan('updated from v1 to v2')}, please read ${chalk.underline('https://github.com/cyrilwanner/next-optimized-images/blob/master/UPGRADING.md')}
17${prefix} If this is on purpose and you don't want this plugin to optimize the images, set the option ${chalk.cyan('`optimizeImages: false`')} to hide this warning.
18`,
19);
20
21module.exports = {
22 showWarning,
23};