-
Notifications
You must be signed in to change notification settings - Fork 71
Closed
Description
Hi,
I'm using module-alias with ncc compiler (https://github.com/zeit/ncc) and seeing weird behavior. If I run the code without the ncc compiler, then it's working fine. However, after ncc compiler, then module-alias is throwing error that it cannot find package.json at some path, even though the path does contain package.json file.
I tried with passing a static path for the module-alias init, and still getting the same error.
After debugging and trying to modify the code of module-alias, I find that if I were to add a temporary variable to join the path first, before the npmPackage require being called, then things will work.
line 171
for (var i in candidatePackagePaths) {
try {
base = candidatePackagePaths[i]
var packageJsonPath = nodePath.join(base, 'package.json')
npmPackage = require(packageJsonPath)
break
} catch (e) {
// noop
}
}
I'm not really sure why assigning the path to a temporary variable before require fixes the problem. Any idea?
Metadata
Metadata
Assignees
Labels
No labels