deno_emit icon indicating copy to clipboard operation
deno_emit copied to clipboard

[emit] Uncaught (in promise) Error: Relative import path "react" not prefixed with / or ./ or ../

Open ynwd opened this issue 2 years ago • 2 comments

I want to emit react component. But got this error.

error: Uncaught (in promise) Error: Relative import path "react" not prefixed with / or ./ or ../
      const ret = new Error(getStringFromWasm0(arg0, arg1));
                  ^
    at __wbg_new_3047bf4b4f02b802 (https://deno.land/x/[email protected]/lib/deno_emit.generated.js:266:19)
    at js_sys::Error::new::h99ffaa64b8859860 (https://deno.land/x/[email protected]/lib/deno_emit_bg.wasm:1:3791529)
    at <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll::hc61726627b994514 (https://deno.land/x/[email protected]/lib/deno_emit_bg.wasm:1:1033771)
    at <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll::h969d4533cb1fa669 (https://deno.land/x/[email protected]/lib/deno_emit_bg.wasm:1:2651228)
    at <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll::hfa8076c654709c85 (https://deno.land/x/[email protected]/lib/deno_emit_bg.wasm:1:2153256)
    at wasm_bindgen_futures::queue::Queue::new::{{closure}}::h8b5a56bdc387819e (https://deno.land/x/[email protected]/lib/deno_emit_bg.wasm:1:2055713)
    at <dyn core::ops::function::FnMut<(A,)>+Output = R as wasm_bindgen::closure::WasmClosure>::describe::invoke::h28c77ba1afeb2b6a (https://deno.land/x/[email protected]/lib/deno_emit_bg.wasm:1:3655458)
    at __wbg_adapter_14 (https://deno.land/x/[email protected]/lib/deno_emit.generated.js:144:6)
    at real (https://deno.land/x/[email protected]/lib/deno_emit.generated.js:128:14)

Repo: https://github.com/ynwd/deno-emit-with-react

ynwd avatar May 18 '22 23:05 ynwd

This is partly "working as designed" as emit doesn't use/have access to the deno.jsonc to provide the compilerOptions being used here, but at the same time, setting compilerOptions is not enabled to overcome this issue.

kitsonk avatar May 19 '22 01:05 kitsonk

I'm hitting this problem too ... in a small dev server that transpiles my ts on the fly for the browser. But, I'm also using import maps, and I assumed it may have been that the new emit module is not using the import map. Could this be the case too, if emit isn't picking up the deno.json, then it also isn't picking up the import map declared there?

jollytoad avatar May 24 '22 09:05 jollytoad

I could not reproduce the bug with the provided repo, neither with v0.0.1 (for which it panics for different reasons), nor with the latest version (for which it transpiles fine).

As for the import map support, this will land with #114.

I think the issue should be closed.

yacinehmito avatar May 03 '23 18:05 yacinehmito