Throw errors when parser can't be found (#14577)

This commit is contained in:
fisker Cheung authored and GitHub committed 2023-03-24 14:07:45 +08:00
1 parent fc81cc13cb
commit 5f4a98e3bc
1 file changed
+6 -4
+6 -4
View File
@@ -18,12 +18,14 @@ function resolveParser({ plugins, parser }) {
}
}
/* c8 ignore next 5 */
/* c8 ignore start */
let message = `Couldn't resolve parser "${parser}".`;
if (process.env.PRETTIER_TARGET === "universal") {
throw new ConfigError(
`Couldn't resolve parser "${parser}". Parsers must be explicitly added to the standalone bundle.`
);
message += " Parsers must be explicitly added to the standalone bundle.";
}
throw new ConfigError(message);
/* c8 ignore stop */
}
async function parse(originalText, options) {