Yes that fixed it!!
Something odd though. I am using a global asset helper for most of my code (using {#asset global-helpers.js @encoding=utf8}
).
When I put the const proxy = require('jsreport-proxy');
at the top of the script file itself it runs fine. But when i put the include statement inside the global-helpers.js file i get the following error:
2018-12-12T15:43:13.741Z - warn: Error when processing render request Error while executing templating engine. Unable to find module jsreport-proxy
Searched paths:
jsreport-proxy
jsreport-proxy
/app/jsreport-proxy
/app/jsreport-proxy
/app/jsreport-proxy
.
3 |
4 |
5 | const proxy = require('jsreport-proxy');
| ^
6 |
Error: Unable to find module jsreport-proxy
Searched paths:
jsreport-proxy
jsreport-proxy
/app/jsreport-proxy
/app/jsreport-proxy
/app/jsreport-proxy
at doRequire (/app/node_modules/jsreport-core/lib/render/safeSandbox.js:213:11)
at _require (/app/node_modules/jsreport-core/lib/render/safeSandbox.js:54:14)
at Object.apply (/app/node_modules/vm2/lib/contextify.js:288:34)
at evaluate-template-engine-helpers.js:5:15
at Script.runInContext (vm.js:101:20)
at VM.run (/app/node_modules/vm2/lib/main.js:212:72)
at run (/app/node_modules/jsreport-core/lib/render/safeSandbox.js:171:19)
at module.exports (/app/node_modules/jsreport-core/lib/render/engineScript.js:114:7)
at IncomingMessage.<anonymous> (/app/node_modules/script-manager/lib/worker-servers.js:239:47)
at IncomingMessage.emit (events.js:182:13)
at IncomingMessage.EventEmitter.emit (domain.js:460:23)
at endReadableNT (_stream_readable.js:1085:12)
at process._tickCallback (internal/process/next_tick.js:63:19)