Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JSR module not found after compile #24871

Closed
Mutefish0 opened this issue Aug 4, 2024 · 1 comment
Closed

JSR module not found after compile #24871

Mutefish0 opened this issue Aug 4, 2024 · 1 comment

Comments

@Mutefish0
Copy link
Contributor

Version: deno 1.44.4

Reproduce

create main.ts:

import { getGamepads } from "jsr:@mutefish/gamepad-api";

async function main() {
  while (true) {
    const gamepads = getGamepads();
    console.log(gamepads);
    await new Promise((resolve) => setTimeout(resolve, 100));
  }
}

main();

compile and execute:

deno compile --unstable-ffi -o main   main.ts && ./main

You will encounter a Module not found error, even though the imported module does exist: https://jsr.io/@mutefish/gamepad-api/0.0.2/libs/aarch64-apple-darwin.ts

error: Uncaught (in promise) TypeError: Module not found: https://jsr.io/@mutefish/gamepad-api/0.0.2/libs/aarch64-apple-darwin.ts
const buff = await import(`./libs/${Deno.build.target}.ts`);
             ^
    at async https://jsr.io/@mutefish/gamepad-api/0.0.2/ffi.ts:2:14

deno run works fine:

deno run --unstable-ffi  main.ts
@lucacasonato
Copy link
Member

https://docs.deno.com/runtime/manual/tools/compiler/#dynamic-imports

You may have to manually include this file: --include=https://jsr.io/@mutefish/gamepad-api/0.0.2/libs/aarch64-apple-darwin.ts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants