mirror of
https://github.com/gradio-app/gradio.git
synced 2025-01-24 10:54:04 +08:00
Fix custom components on windows (#8531)
* Fix usability windows * Add config.js * Add code * revert pnpm.lock' * add changeset --------- Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
This commit is contained in:
parent
a4433be25c
commit
88de38e259
6
.changeset/slick-ducks-fry.md
Normal file
6
.changeset/slick-ducks-fry.md
Normal file
@ -0,0 +1,6 @@
|
||||
---
|
||||
"@gradio/preview": patch
|
||||
"gradio": patch
|
||||
---
|
||||
|
||||
fix:Fix custom components on windows
|
@ -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):
|
||||
|
@ -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 || [];
|
||||
|
@ -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 || [];
|
||||
@ -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`;
|
||||
|
Loading…
Reference in New Issue
Block a user