denoland / deno_emit

Transpile and bundle JavaScript and TypeScript under Deno and Deno Deploy
https://jsr.io/@deno/emit
MIT License
223 stars 23 forks source link

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

Closed ynwd closed 1 year ago

ynwd commented 2 years ago

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/emit@0.0.1/lib/deno_emit.generated.js:266:19)
    at js_sys::Error::new::h99ffaa64b8859860 (https://deno.land/x/emit@0.0.1/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/emit@0.0.1/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/emit@0.0.1/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/emit@0.0.1/lib/deno_emit_bg.wasm:1:2153256)
    at wasm_bindgen_futures::queue::Queue::new::{{closure}}::h8b5a56bdc387819e (https://deno.land/x/emit@0.0.1/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/emit@0.0.1/lib/deno_emit_bg.wasm:1:3655458)
    at __wbg_adapter_14 (https://deno.land/x/emit@0.0.1/lib/deno_emit.generated.js:144:6)
    at real (https://deno.land/x/emit@0.0.1/lib/deno_emit.generated.js:128:14)

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

kitsonk commented 2 years ago

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.

jollytoad commented 2 years ago

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?

yacinehmito commented 1 year ago

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.