Skip to content

Commit

Permalink
Fix requireOptional error and nodemailer require, fix keystonejs#15
Browse files Browse the repository at this point in the history
I had to make the same fixes that I later saw suggested by @ivanclaud to
get this working locally.
  • Loading branch information
Nate Eagle committed Dec 8, 2016
1 parent c70cecc commit 7540d1c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/transports/nodemailer/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
var requireOptional = require('../util/requireOptional');
var requireOptional = require('../../util/requireOptional');

var assign = require('object-assign');
var nodemailer = requireOptional('nodemailer', 'Please install the nodemailer package to use this transport');
Expand Down
2 changes: 1 addition & 1 deletion lib/util/requireOptional.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module.exports = function (pkg, msg) {
try {
return require('pkg');
return require(pkg);
} catch (e) {
if (e.code === 'MODULE_NOT_FOUND') {
throw new Error(msg);
Expand Down

1 comment on commit 7540d1c

@ansgarm
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just ran into the same problem. Could someone please merge this fix? :)

Please sign in to comment.