mirror of
https://github.com/gradio-app/gradio.git
synced 2025-04-06 12:30:29 +08:00
Fix issue with virtual module in custom components (#8761)
* fix bug * add changeset * fix really --------- Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
This commit is contained in:
parent
1e8f31b09a
commit
078663a3a4
5
.changeset/tender-pianos-cross.md
Normal file
5
.changeset/tender-pianos-cross.md
Normal file
@ -0,0 +1,5 @@
|
||||
---
|
||||
"@gradio/preview": patch
|
||||
---
|
||||
|
||||
fix:Fix issue with virtual module in custom components
|
@ -69,6 +69,8 @@ export function make_gradio_plugin({
|
||||
backend_port,
|
||||
imports
|
||||
}: GradioPluginOptions): Plugin {
|
||||
const v_id = "virtual:component-loader";
|
||||
const resolved_v_id = "\0" + v_id;
|
||||
return {
|
||||
name: "gradio",
|
||||
enforce: "pre",
|
||||
@ -90,6 +92,9 @@ export function make_gradio_plugin({
|
||||
};
|
||||
},
|
||||
resolveId(id) {
|
||||
if (id === v_id) {
|
||||
return resolved_v_id;
|
||||
}
|
||||
if (
|
||||
id !== "svelte" &&
|
||||
id !== "svelte/internal" &&
|
||||
@ -98,6 +103,11 @@ export function make_gradio_plugin({
|
||||
return join(svelte_dir, "svelte-submodules.js");
|
||||
}
|
||||
},
|
||||
load(id) {
|
||||
if (id === resolved_v_id) {
|
||||
return `export default {};`;
|
||||
}
|
||||
},
|
||||
transformIndexHtml(html) {
|
||||
return mode === "dev"
|
||||
? [
|
||||
|
19
pnpm-lock.yaml
generated
19
pnpm-lock.yaml
generated
@ -1688,6 +1688,25 @@ importers:
|
||||
specifier: ^3.28.0
|
||||
version: 3.28.0
|
||||
|
||||
js/preview/test/mycomponent/frontend:
|
||||
dependencies:
|
||||
'@gradio/atoms':
|
||||
specifier: workspace:^
|
||||
version: link:../../../../atoms
|
||||
'@gradio/icons':
|
||||
specifier: workspace:^
|
||||
version: link:../../../../icons
|
||||
'@gradio/statustracker':
|
||||
specifier: workspace:^
|
||||
version: link:../../../../statustracker
|
||||
'@gradio/utils':
|
||||
specifier: workspace:^
|
||||
version: link:../../../../utils
|
||||
devDependencies:
|
||||
'@gradio/preview':
|
||||
specifier: workspace:^
|
||||
version: link:../../..
|
||||
|
||||
js/preview/test/test/frontend: {}
|
||||
|
||||
js/radio:
|
||||
|
Loading…
x
Reference in New Issue
Block a user