Skip to content

Commit 9ebf187

Browse files
authoredDec 17, 2020
Fixes mistaken MODULE_NOT_FOUND error for missing dependency (#5255)
1 parent a54d5c4 commit 9ebf187

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed
 

‎.changeset/loud-clouds-lick.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@graphql-codegen/cli': patch
3+
---
4+
5+
Fix wrong MODULE_NOT_FOUND for missing dependencies

‎packages/graphql-codegen-cli/src/plugins.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export async function getPluginByName(
2222
try {
2323
return await pluginLoader(moduleName);
2424
} catch (err) {
25-
if (err.code !== 'MODULE_NOT_FOUND') {
25+
if (err.code !== 'MODULE_NOT_FOUND' || !err.message.includes(moduleName)) {
2626
throw new DetailedError(
2727
`Unable to load template plugin matching ${name}`,
2828
`

‎packages/graphql-codegen-cli/src/presets.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export async function getPresetByName(
1818

1919
return loaded as Types.OutputPreset;
2020
} catch (err) {
21-
if (err.code !== 'MODULE_NOT_FOUND') {
21+
if (err.code !== 'MODULE_NOT_FOUND' || !err.message.includes(moduleName)) {
2222
throw new DetailedError(
2323
`Unable to load preset matching ${name}`,
2424
`

0 commit comments

Comments
 (0)
Please sign in to comment.