Merge pull request #1526 from sapics/patch1

Fix Cannot read property 'parent' of undefined in node
This commit is contained in:
sapics 2018-09-29 12:16:53 +09:00 committed by GitHub
commit d55249919e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -17,7 +17,7 @@ var path = require('path');
// Determine the name by which name the module was required (either 'paper',
// 'paper-jsdom' or 'paper-jsdom-canvas'), and use this to determine if error
// exceptions should be thrown or if loading should fail silently.
var parent = module.parent.parent,
var parent = module.parent ? module.parent.parent : null,
requireName = parent && path.basename(path.dirname(parent.filename));
requireName = /^paper/.test(requireName) ? requireName : 'paper';