* one can load another JS file in the Kamailio KEMI JS
file, but this another JS file has its content following the node.js module specs, right?
It cannot be just any JS code
I think the require() must be a node.js, but not sure from my reading of
https://github.com/svaarala/duktape/tree/master/extras/module-node. My local testing
looks like this:
```
var test_include = require('./test');
function ksr_request_route()
{
test_include();
```
./test.js
```
module.exports = function test_include()
{
KSR.info('LOG FROM INCLUDED test FUNCTION--------');
};
```
My testing includes do not work as expected without module.exports.
---
* does it allow loading any node.js modules available
out there that do not require the node.js core modules (which are embedded (compiled) in
node.js binary)?
I tried testing using a simple NPM module with a relative include and kamailio would not
start with error
` jsdt_kemi_load_script(): failed running: SyntaxError: expected identifier`
I think this indicates as currently implemented not just any node.js module can be used.
This PR does not try to resolve package names and only tries to resolve relative and
absolute files.
--
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/pull/3038#issuecomment-1054866552
You are receiving this because you are subscribed to this thread.
Message ID: <kamailio/kamailio/pull/3038/c1054866552(a)github.com>