From 6e4666a28fbb693bc89c8161219479b2bb4f79a0 Mon Sep 17 00:00:00 2001 From: Norbert de Langen Date: Tue, 20 Feb 2024 12:12:52 +0100 Subject: [PATCH] Apply suggestions from code review Co-authored-by: Yann Braga --- code/lib/core-events/src/errors/server-errors.ts | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/code/lib/core-events/src/errors/server-errors.ts b/code/lib/core-events/src/errors/server-errors.ts index acdce05da1df..cf913ab0d228 100644 --- a/code/lib/core-events/src/errors/server-errors.ts +++ b/code/lib/core-events/src/errors/server-errors.ts @@ -411,10 +411,10 @@ export class MainFileESMOnlyImportError extends StorybookError { template() { const message = [ - `Storybook failed to load ${this.data.location}..`, + `Storybook failed to load ${this.data.location}`, '', `It looks like the file tried to load/import an ESM only module.`, - `Support for this is currently limited in ${this.data.location}.`, + `Support for this is currently limited in ${this.data.location}`, `You can import ESM modules in your main file, but only as dynamic import.`, '', ]; @@ -423,7 +423,7 @@ export class MainFileESMOnlyImportError extends StorybookError { white( `In your ${yellow(this.data.location)} file, line ${bold.cyan( this.data.num - )} threw an error, which looks like this:` + )} threw an error:` ), grey(this.data.line) ); @@ -431,10 +431,9 @@ export class MainFileESMOnlyImportError extends StorybookError { message.push( '', - white(`Convert the static import to an dynamic import ${underline('where they are used')}.`), + white(`Convert the static import to a dynamic import ${underline('where they are used')}.`), white(`Example:`) + ' ' + gray(`await import();`), '', - 'For more information, please read the documentation link below.' ); return message.join('\n'); @@ -457,7 +456,7 @@ export class MainFileMissingError extends StorybookError { template() { return dedent` No configuration files have been found in your configDir: ${yellow(this.data.location)}. - Storybook needs "main.js" file, please add it. + Storybook needs a "main.js" file, please add it. You can pass a --config-dir flag to tell Storybook, where your main.js file is located at). `; @@ -572,7 +571,7 @@ export class UpgradeStorybookUnknownCurrentVersionError extends StorybookError { return dedent` We couldn't determine the current version of Storybook in your project. - Are you running the storybook CLI in a project without Storybook? + Are you running the Storybook CLI in a project without Storybook? It might help if you specify your Storybook config directory with the --config-dir flag. `; }