Skip to content

Commit

Permalink
fix: webpack projects no longer show warning for cardinal dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
Mike DiDomizio committed Jul 2, 2022
1 parent ab3feb7 commit 26c56ae
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ exports.srcEscape = srcEscape;
let highlightFn;
let cardinalRecommended = false;
try {
highlightFn = require('cardinal').highlight;
// the purpose of this is to prevent projects using Webpack from displaying a warning during runtime if cardinal is not a dependency
const REQUIRE_TERMINATOR = '';
highlightFn = require(`cardinal${REQUIRE_TERMINATOR}`).highlight;
} catch (err) {
highlightFn = text => {
if (!cardinalRecommended) {
Expand Down

0 comments on commit 26c56ae

Please sign in to comment.