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

Error running built webassembly library #139

Closed
mush42 opened this issue May 1, 2024 · 3 comments
Closed

Error running built webassembly library #139

mush42 opened this issue May 1, 2024 · 3 comments

Comments

@mush42
Copy link

mush42 commented May 1, 2024

Following the tutorial, I faced following error:

error: Relative import path "env" not prefixed with / or ./ or ../
    at file:///.lib/libtashkeel_wasm.generated.js:10:26
@dsherret
Copy link
Member

dsherret commented May 1, 2024

Which tutorial? Would you be able to post your code?

@mush42
Copy link
Author

mush42 commented May 1, 2024

@dsherret

wasm-bindgen = "0.2.92"

Rust code:

mod utils;
use wasm_bindgen::prelude::*;

#[wasm_bindgen]
pub fn process(
    text: &str,
    threshold: Option<f32>,
    preprocessed: Option<bool>,
) -> String {
    utils::set_panic_hook();
    todo!()
}

Run build command for package:

deno task wasmbuild -p libtashkeel-wasm

deno.json

{
  "tasks": {
    "dev": "deno run --watch main.ts",
    "wasmbuild": "deno run -A jsr:@deno/[email protected]"
  }
}

main.ts:

import { process, instantiate } from "./lib/libtashkeel_wasm.generated.js";

if (import.meta.main) {
  await instantiate();
  console.log(process("Hello"));
}

@mush42
Copy link
Author

mush42 commented May 1, 2024

@mush42 mush42 closed this as not planned Won't fix, can't repro, duplicate, stale May 1, 2024
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