frida / frida-compile

Compile a Frida script comprised of one or more Node.js modules
Other
190 stars 48 forks source link

Unable to resolve local module on 16.1.10 #55

Closed AeonLucid closed 2 years ago

AeonLucid commented 2 years ago

Host Windows 10 Target iOS

index.ts

import { blabla } from "./utils";

blabla();

utils.ts

export function blabla() {
    console.log('Hi');
}

Error

Error: unable to resolve: E:/Aeon/agent/utils
    at Object.bundle (file:///E:/Aeon/node_modules/frida-compile/dist/compiler.js:324:23)
    at Module.build (file:///E:/Aeon/node_modules/frida-compile/dist/compiler.js:47:20)
    at main (file:///E:/Aeon/node_modules/frida-compile/dist/cli.js:37:33)
    at file:///E:/Aeon/node_modules/frida-compile/dist/cli.js:57:5
    at ModuleJob.run (node:internal/modules/esm/module_job:198:25)
    at async Promise.all (index 0)
    at async ESMLoader.import (node:internal/modules/esm/loader:385:24)
    at async loadESM (node:internal/process/esm_loader:88:5)
    at async handleMainPromise (node:internal/modules/run_main:61:12)
oleavr commented 2 years ago

import { blabla } from "./utils";

Should be:

import { blabla } from "./utils.js";

(Like Node.js we require the extension to be explicitly provided.)

AeonLucid commented 2 years ago

Shouldn't it be .ts?

oleavr commented 2 years ago

No, it's the compiled name (which is a bit confusing indeed).

0x5e commented 2 years ago

can it be automatically converted?

oleavr commented 2 years ago

@0x5e There's no need, the TypeScript compiler understands it and expects it that way.