You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to invoke an .mjs or ES module from a string is this somehow possible?
I've seen this issue and from file should be supported #151
However in this case, I'm using a class library and the file is an Embedded Resource, so then its invoked with InvokeFromStringAsync
[10:54:39 WRN] [Jering.Javascript.NodeJS.HttpNodeJSService] An invocation attempt failed. Retries using existing process remaining: 0.
Exception:
Jering.Javascript.NodeJS.InvocationException: Unexpected token 'export'
anonymous:2
export default async (
^^^^^^
SyntaxError: Unexpected token 'export'
at internalCompileFunction (node:internal/vm:73:18)
at wrapSafe (node:internal/modules/cjs/loader:1274:20)
at Module._compile (node:internal/modules/cjs/loader:1320:27)
at IncomingMessage.<anonymous> (file:///S:/git/rig/midgard.pwa/[eval1]:170:21)
at IncomingMessage.emit (node:events:517:28)
at endReadableNT (node:internal/streams/readable:1400:12)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
at Jering.Javascript.NodeJS.HttpNodeJSService.TryInvokeAsync[T](InvocationRequest invocationRequest, CancellationToken cancellationToken)
at Jering.Javascript.NodeJS.OutOfProcessNodeJSService.TryInvokeCoreAsync[T](InvocationRequest invocationRequest, CancellationToken cancellationToken)
Any help would be appreciated thank you 🙇♂️
The text was updated successfully, but these errors were encountered:
stephenlautier
changed the title
ESM modules InvokeFromStringAsync
ES modules InvokeFromStringAsync
Sep 10, 2024
I found a solution to this and might be better actually in this case
Basically having the mjs file as EmbededResource -> convert to string -> write file (in host) and invoke it as a file - ESM is supported that way and it avoids the transfer of the script as string + compile which is done in this library (so I believe its more efficient)
Hi,
I'm trying to invoke an
.mjs
or ES module from a string is this somehow possible?I've seen this issue and from file should be supported #151
However in this case, I'm using a class library and the file is an Embedded Resource, so then its invoked with
InvokeFromStringAsync
Any help would be appreciated thank you 🙇♂️
The text was updated successfully, but these errors were encountered: