Conversation
| private readonly pluginDir: string; | ||
| readonly require: (name: string) => any = topModule.require.bind(topModule); | ||
| private readonly resolve = (request: string) => (module.constructor as any)._resolveFilename(request, topModule); | ||
| private readonly resolve = (request: string) => resolve.sync(request); |
There was a problem hiding this comment.
Question about this, the current form (module.constructor as any)._resolveFilename(request, topModule); ensures that the resolution is done from the point of view of the topmost module (the main app). This is necessary because if for example you have skwalking npm linked into a project instead of installed alongside all its dependancies then normal resolve will get the wrong path, one that sits in the skywalking node_modules path instead of the applicatiuon. Does the resolve package do this?
There was a problem hiding this comment.
Sorry, I missed this point. According to the documentation resolve, this can be done by
private readonly resolve = (request: string) => resolve.sync(request, {basedir: path.dirname(topModule.id) });
if You agree i will update later
There was a problem hiding this comment.
Ok, well I checked your fix and it seems to work, so I am ok with this.
What do you mean by "does not export"? It HAS a |
I'm sorry my description is not clear enough, I have updated it.
while |
|
Some ideas for your plugin:
@kezhenxu94 asked me to review this because I also recently added a |
|
Actually, better look at #31, master had some errors. |
|
Hey @zijin-m, going back to #27 where you said:
I realize some time has passed, but is there any chance you can provide a short snippet case of this happening before the |
|
Closing in favor of #54 |
In addition, use the
resolvepackage to readpackage.jsonbecausemysql2does not addpackage.jsonin theexportsfield of thepackage.jsonfile