ozomer / node-red-contrib-unsafe-function

The fast and furious version of function nodes
1 stars 5 forks source link

add require #4

Closed shimondoodkin closed 7 years ago

ozomer commented 7 years ago

Hi @shimondoodkin , Is this commit really necessary? It seems that require-from-string works fine with code that uses require.

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 calling require did not work?

shimondoodkin commented 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.

shimondoodkin commented 7 years ago

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.

ozomer commented 7 years ago

Maybe this is a bug with require-from-string? It just feels too dangerous to override "require".

zinen commented 1 year ago

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 :)