Open OmgImAlexis opened 5 years ago
I'm assuming it's got something todo with how they change require.
Any updates?
I also came across this need, and I am doing some experiments to try to get esm
work with pkg
. Here is what I've found:
pkg
is using vm.Script
to compile source code into v8 byte code. For that to happen, I will need to get the "transformed" javascript code. Is there any programmtical usage of esm
to expose the transformed code?pkg
has some "prelude" code to be executed before any other source. In there, pkg
would overwrite fs
and module
functions (as @OmgImAlexis has mentioned earlier). So my plan is to execute esm
first, and then execute the prelude code.This is fixed with Node >= 13 but PKG doesn't yet support it. Related:
I'm trying to get pkg working with esm and I've hit an issue which I can't seem to trackdown the source.
To reproduce: