-
Notifications
You must be signed in to change notification settings - Fork 41
__dirname doesn't work in modules that are part of the snapshot #9
Comments
Probably how the
|
I tried modifying the |
@as-cii this seems reasonable to me but want your opinion. |
I wasn't able to fix this problem because you need the |
Yes, at snapshot creation the One workaround, as you're pointing out, could be to change the transformation routine to replace every instance of function get__dirname(relativePath) {
if (userHasSetAbsolutePath) {
return path.join(absolutePath, relativePath)
} else {
return relativePath
}
} Then, at load time we could call |
Yes. This is what I was thinking. It would be awesome to fix this problem for future apps. In our case, we replaced all instances of Thanks for the detailed suggestion and explanation @as-cii! |
I noticed that
__dirname
returns relative paths instead of absolute when executed in a module that is part of the snapshot.What is the reason of this happening? Is it possible this to be fixed or is it a limitation of the implementation?
The text was updated successfully, but these errors were encountered: