storybook/code/lib/core-webpack/src/check-webpack-version.ts
Norbert de Langen c2bbe43d02
stage0
2022-07-21 11:24:07 +02:00

25 lines
795 B
TypeScript

import { logger } from '@storybook/node-logger';
import { dedent } from 'ts-dedent';
export const checkWebpackVersion = (
webpack: { version?: string },
specifier: string,
caption: string
) => {
if (!webpack.version) {
logger.info('Skipping webpack version check, no version available');
return;
}
if (webpack.version !== specifier) {
logger.warn(dedent`
Unexpected webpack version in ${caption}:
- Received '${webpack.version}'
- Expected '${specifier}'
If you're using Webpack 5 in SB6.2 and upgrading, consider: https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#webpack-5-manager-build
For more info about Webpack 5 support: https://gist.github.com/shilman/8856ea1786dcd247139b47b270912324#troubleshooting
`);
}
};