Skip to content

Commit

Permalink
Adapt optionalRequire to new expect version
Browse files Browse the repository at this point in the history
  • Loading branch information
maltsev committed Apr 15, 2023
1 parent 9ee7dd4 commit bc4906f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/helpers.es6
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ export function isEventHandler(attributeName) {

export function optionalRequire(moduleName) {
try {
return require(moduleName);
const module = require(moduleName);
return module.default || module;
} catch (e) {
if (e.code === 'MODULE_NOT_FOUND') {
return null;
Expand Down

0 comments on commit bc4906f

Please sign in to comment.