A required chunk runs in global environment by default.
Each loaded user script is setup to run in a sandbox and if the script happens to contain a require call, it will modify the global environment.
Is there a way to set that environment to the same one of the calling script?
Yes, you can replace require
with your own function.
The prosody XMPP server does this here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With