frida-compile
frida-compile copied to clipboard
Invalid tokens
Just out of curiosity, why are the invalid tokens in the generated output?
in frida-agent-example,
$ npx frida-compile agent/index.ts -o _agent.js -c

This doen's look valid javascript by the way..., that is to say,
% node _agent.js
/Users/wc/scratch/frida-tools/frida-agent-example/_agent.js:1
📦
^
SyntaxError: Invalid or unexpected token
at Object.compileFunction (node:vm:352:18)
The output is not JavaScript, it's a simple container format (Frida-specific) for a bundle of ES Modules. It's in a human-readable text-encoding though to make it easy to inspect.
I see. thanks. Anyway to turn it off so that I can generate a quick bundled agent.js for injection?
I met the same problem too and it still bothers me too, is it because version of node of python? I tried but not work...
How did this problem finally be solved? I also want to generate a JS file that can be run directly.
i was running into issues with this when using evaluate
with objection, using bun (or any bundler for that matter) pointing towards your entry script (index.ts) fixed this!
for bun the command used:
bun build ./agent/index.ts --outdir ./