Closed shimondoodkin closed 7 years ago
I think I added this by mistake, maybe it did not work for me in the regular function. so I took for granted it's same in unsafe function. sorry.
maybe there is something to it. actually
with my modification it loads also from ~/.node-red/node_modules/
without it it loads only from installation of node red. for example if i cloned from git node red to /root/app/red it loaded ony from /root/app/red/node_modules
not sure why or if it is really happens.
i discovered this by misstake, after this talk, i had updated node-red-contrib-unsafe-function, at first it seemd working and have require function. but then it started to not find the modules.
i have not searched for the bug why, just moved my modules there.
Maybe this is a bug with require-from-string
? It just feels too dangerous to override "require".
This info would be nice to have available in the help section of this node. I did not think I could simply write const os = require('os')
. Thanks for the info :)
Hi @shimondoodkin , Is this commit really necessary? It seems that
require-from-string
works fine with code that usesrequire
.I did not check all node-js versions, and I now noticed that
require-from-string
already reached version 2.0.1 so I guess I should update the code. Under which condition did it actually occur to you that callingrequire
did not work?