Skip to content

Commit 0043029

Browse files
authored
feat: fail build process upon @Inject interpolation failure in prod (#9354)
1 parent 873d850 commit 0043029

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/remark-variables.js

+8
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,15 @@ export default function remarkVariables(options) {
6363
throw err;
6464
}
6565

66+
// replace the match with the result (even if it's empty)
6667
node.value = node.value.replace(match[0], result);
68+
if (!result) {
69+
console.error(new Error(`Failed to interpolate expression: "${expr}"`));
70+
// fail the build process in production
71+
if (process.env.NODE_ENV === 'production') {
72+
process.exit(1);
73+
}
74+
}
6775
});
6876
}
6977
);

0 commit comments

Comments
 (0)