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

Fix custom components on windows #8531

Merged
merged 5 commits into from
Jun 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changeset/slick-ducks-fry.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@gradio/preview": patch
"gradio": patch
---

fix:Fix custom components on windows
2 changes: 1 addition & 1 deletion gradio/cli/commands/components/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def _build(
package_name = get_deep(pyproject_toml, ["project", "name"])

python_path = _get_executable_path(
"python", None, "--python-path", check_3=True
"python", python_path, "--python-path", check_3=True
)

if not isinstance(package_name, str):
Expand Down
4 changes: 3 additions & 1 deletion js/preview/src/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,9 @@ export async function make_build({
comp.frontend_dir &&
fs.existsSync(join(comp.frontend_dir, "gradio.config.js"))
) {
const m = await import(join(comp.frontend_dir, "gradio.config.js"));
const m = await import(
join("file://" + comp.frontend_dir, "gradio.config.js")
);

component_config.plugins = m.default.plugins || [];
component_config.svelte.preprocess = m.default.svelte?.preprocess || [];
Expand Down
6 changes: 3 additions & 3 deletions js/preview/src/dev.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ async function generate_imports(
fs.existsSync(join(component.frontend_dir, "gradio.config.js"))
) {
const m = await import(
join(component.frontend_dir, "gradio.config.js")
join("file://" + component.frontend_dir, "gradio.config.js")
);

component_config.plugins = m.default.plugins || [];
Expand All @@ -184,13 +184,13 @@ async function generate_imports(
);

const example = exports.example
? `example: () => import("${to_posix(
? `example: () => import("/@fs/${to_posix(
join(component.frontend_dir, exports.example)
)}"),\n`
: "";
return `${acc}"${component.component_class_id}": {
${example}
component: () => import("${to_posix(
component: () => import("/@fs/${to_posix(
join(component.frontend_dir, exports.component)
)}")
},\n`;
Expand Down