Skip to content

Commit 2bc513c

Browse files
authored
Merge pull request #1589 from mikedidomizio/hide-require-warnings-with-webpack
fix: webpack projects no longer show warning for cardinal dependency
2 parents 502d586 + 26c56ae commit 2bc513c

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/helpers.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,9 @@ exports.srcEscape = srcEscape;
2525
let highlightFn;
2626
let cardinalRecommended = false;
2727
try {
28-
highlightFn = require('cardinal').highlight;
28+
// the purpose of this is to prevent projects using Webpack from displaying a warning during runtime if cardinal is not a dependency
29+
const REQUIRE_TERMINATOR = '';
30+
highlightFn = require(`cardinal${REQUIRE_TERMINATOR}`).highlight;
2931
} catch (err) {
3032
highlightFn = text => {
3133
if (!cardinalRecommended) {

0 commit comments

Comments
 (0)