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

Using wasm target gives error: Error resolving module specifier “env”. Relative module specifiers must start with “./”, “../” or “/”. #70

Closed
johansmitsnl opened this issue May 26, 2021 · 1 comment

Comments

@johansmitsnl
Copy link

johansmitsnl commented May 26, 2021

When I load the i18n_embed::select it gives me this error with a wasm target.

i18n-embed = { version = "0.12", features = ["fluent-system", "web-sys-requester"] }
rust-embed = { version = "5", features = ["debug-embed"] }
// lib.rs

use i18n_embed::{
    WebLanguageRequester,
};
use rust_embed::RustEmbed;

use i18n_embed::fluent::{FluentLanguageLoader, fluent_language_loader};

#[derive(RustEmbed)]
#[folder = "i18n"] // path to the compiled localization resources
struct Localizations;

#[wasm_bindgen(start)]
pub fn main() {
  let language_loader: FluentLanguageLoader = fluent_language_loader!();
  let requested_languages = WebLanguageRequester::requested_languages();
  let _result = i18n_embed::select(&language_loader, &Localizations, &requested_languages);
}
# i18n.toml

fallback_language = "en"

[fluent]
assets_dir = "i18n"
# i18n/en/frontend.ftl

logout = Logout translated

On the browser console a error message from WASM: Uncaught TypeError: Error resolving module specifier “env”. Relative module specifiers must start with “./”, “../” or “/”.

@johansmitsnl
Copy link
Author

Not related to this project but this was my search trace for anyone that encounters it: rustwasm/wasm-pack#743, rustwasm/wasm-bindgen#2215, rustwasm/wasm-bindgen#2160, /rustwasm/wasm-pack#743 and finally Amanieu/parking_lot#269.

So pinging down parking_lot_core = "=0.8.0" the error goes away.

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

1 participant