Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Yann Braga <[email protected]>
  • Loading branch information
ndelangen and yannbf authored Feb 20, 2024
1 parent a321a58 commit 6e4666a
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions code/lib/core-events/src/errors/server-errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.`,
'',
];
Expand All @@ -423,18 +423,17 @@ 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)
);
}

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(<your ESM only module>);`),
'',
'For more information, please read the documentation link below.'
);

return message.join('\n');
Expand All @@ -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).
`;
Expand Down Expand Up @@ -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.
`;
}
Expand Down

0 comments on commit 6e4666a

Please sign in to comment.