Gradio custom component dev mode now detects changes to Example.svelte file (#6457)

* WIP

* fix

* WIP

* Remove console log

* add changeset

* add changeset

* use strict

---------

Co-authored-by: pngwn <hello@pngwn.io>
Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
This commit is contained in:
Freddy Boulton 2023-11-16 14:30:31 -05:00 committed by GitHub
parent 58e3ca8260
commit d00fcf89d1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 4 deletions

View File

@ -0,0 +1,7 @@
---
"@gradio/app": patch
"@gradio/preview": patch
"gradio": patch
---
fix:Gradio custom component dev mode now detects changes to Example.svelte file

View File

@ -9,7 +9,6 @@ export async function load_component({ api_url, name, id, variant }) {
...(!comps ? {} : comps)
};
try {
//@ts-ignore
const c = await (
_component_map?.[id]?.[variant] || // for dev mode custom components
_component_map?.[name]?.[variant]

View File

@ -122,13 +122,13 @@ function generate_imports(component_dir: string, root: string): string {
);
const exports: Record<string, string | undefined> = {
component: pkg.exports["."] as string,
exmaple: pkg.exports["./example"] as string
component: pkg.exports["."],
example: pkg.exports["./example"]
};
const example = exports.example
? `example: () => import("${to_posix(
join(component.frontend_dir, "example")
join(component.frontend_dir, exports.example)
)}"),\n`
: "";
return `${acc}"${component.component_class_id}": {