Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[cli] add information link to web platform metro error #27884

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
17 changes: 11 additions & 6 deletions packages/@expo/cli/src/export/resolveOptions.ts
Expand Up @@ -2,6 +2,7 @@ import { ExpoConfig, getConfig, Platform } from '@expo/config';

import { getPlatformBundlers, PlatformBundlers } from '../start/server/platformBundlers';
import { CommandError } from '../utils/errors';
import { learnMore } from '../utils/link';

export type Options = {
outputDir: string;
Expand Down Expand Up @@ -39,12 +40,16 @@ export function resolvePlatformOption(
// Pass through so the more robust error message is shown.
return platform;
}
throw new CommandError(
'BAD_ARGS',
`Platform "${platform}" is not configured to use the Metro bundler in the project Expo config, or is missing from the supported platforms in the platforms array: [${exp.platforms?.join(
', '
)}].`
);

let error = `Platform "${platform}" is not configured to use the Metro bundler in the project Expo config, or is missing from the supported platforms in the platforms array: [${exp.platforms?.join(
', '
)}].`;

if (platform === 'web') {
error += ' ' + learnMore('https://docs.expo.dev/guides/customizing-metro/#web-support');
kbrandwijk marked this conversation as resolved.
Show resolved Hide resolved
}

throw new CommandError('BAD_ARGS', error);
}

return platform;
Expand Down