Skip to content

Commit

Permalink
Fix Could not resolve "virtual:component-loader" in gradio/utils pa…
Browse files Browse the repository at this point in the history
…ckage (gradio-app#8927)

* add catch clause to fix not being able to use newest npm package versions

* format

* add changeset

* add changeset

---------

Co-authored-by: Freddy Boulton <alfonsoboulton@gmail.com>
Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
  • Loading branch information
3 people authored Jul 29, 2024
1 parent 69f1e36 commit 223688b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
6 changes: 6 additions & 0 deletions .changeset/rude-women-fly.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@gradio/utils": patch
"gradio": patch
---

fix:Fix `Could not resolve "virtual:component-loader"` in gradio/utils package
12 changes: 8 additions & 4 deletions js/utils/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -234,10 +234,14 @@ export class Gradio<T extends Record<string, any> = Record<string, any>> {
this.client = client;

if (!virtual_component_loader) {
import("virtual:component-loader").then((module) => {
this._load_component = module.load_component;
virtual_component_loader = module.load_component;
});
import("virtual:component-loader")
.then((module) => {
this._load_component = module.load_component;
virtual_component_loader = module.load_component;
})
.catch((e) => {
console.error("Error loading virtual component loader", e);
});
} else {
this._load_component = virtual_component_loader;
}
Expand Down

0 comments on commit 223688b

Please sign in to comment.