ozomer / node-red-contrib-unsafe-function

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

'Require' imports from parent, not "config" #5

Open prozacgod opened 6 years ago

prozacgod commented 6 years ago

This may be "as designed" but it was a bit confusing. And I run Node-red in a bit different manner, so this could be my fault.

I run my node-red admin tool not as a global install but from a directory where I control the arguments to the config folder.

example

mkdir ~/NodeRed yarn init -y . yarn add node-red yarn add node-red-admin mkdir config I run node red once, stop it set the password, and restart. yarn node-red -u config -v

~/NodeRed <- parent project that hosts all my node-red junk

~/NodeRed/config <- node red flow project as edited by node-red

I i go into the NodeRed/config directory and install a package - (I installed https://www.npmjs.com/package/rss-node-mongo)

and then created an unsafe function to import it.

I could not import the module from within that unsafe function

but when I added it to the ~/NodeRed project it worked fine.

I've never deployed my node-red projects as they are all for personal use or home projects or whatever and I prefer to keep the admin tool running for my needs. BUT ... I think unsafe function would break in this context, not being able to find the module, and would need the module installed as a global.

Thoughts?