bytenode/bytenode

TypeError: Invalid host defined options

scanline opened this issue · 2 comments

In my code I'm importing a module like:
const compiler = await import("file://compiler.js");

Once that code is compiled using Bytenode it crashes with the following error:

TypeError: Invalid host defined options
    at Compiler.compile (evalmachine.<anonymous>:1:3133)
    at IpcMainImpl.<anonymous> (evalmachine.<anonymous>:1:36313)
    at IpcMainImpl.emit (node:events:527:28)
    at EventEmitter.<anonymous> (node:electron/js2c/browser_init:165:11133)
    at EventEmitter.emit (node:events:527:28)

You cannot use es modules with bytenode. You must use the require function for that. Either write your code with it, or transpile it using webpack or another tool.

Oh, I was afraid this might be the problem. Thanks for clarifying Osama!