-
Notifications
You must be signed in to change notification settings - Fork 100
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
Evaluate updated module #885
Comments
|
let main_module = deno_core::resolve_path(file_path, env::current_dir()?.as_path())?;
fs::write(file_path, "console.log(\"1\")")?;
// js_runtime.lazy_load_es_module_with_code()
let mod_id = js_runtime.load_side_es_module(&main_module).await?;
let _ = js_runtime.mod_evaluate(mod_id).await?;
// [out]: "hello 1"
js_runtime.run_event_loop(Default::default()).await?;
// main_module updated here, now it contains
// source code below
fs::write(file_path, "console.log(\"2\")")?;
// Maybe something like .update_side_es_module?
let mod_id = js_runtime.load_side_es_module(&main_module).await?;
let _ = js_runtime.mod_evaluate(mod_id).await?;
// should log [out]: "hello 2"
// but got error
// assertion `left == right` failed: Module already evaluated.
// Perhaps you've re-provided a module or extension that was already included in the snapshot
js_runtime.run_event_loop(Default::default()).await?; Ok, now I understand. Is this possible in deno_core? How can such functionality be achieved? |
@marvinhagemeister opened a pull request here #890 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Should I create a new JsRuntime instance and load the updated file?
The text was updated successfully, but these errors were encountered: