const parentPath = parentModule(__filename);
- const filePath = resolveFrom(path.dirname(parentPath), moduleId);
+ const cwd = parentPath ? path.dirname(parentPath) : __dirname;
+ const filePath = resolveFrom(cwd, moduleId);
const oldModule = require.cache[filePath];
// Delete itself from module parent