Be able to set optimizeDeps options in gradio.config.js (#9091)

* Add code

* add changeset

* build

* Remove unused import

---------

Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
This commit is contained in:
Freddy Boulton 2024-08-14 14:15:28 -04:00 committed by GitHub
parent 13010fdfd7
commit bbbd1f5ebe
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 13 additions and 2 deletions

View File

@ -0,0 +1,5 @@
---
"@gradio/preview": minor
---
feat:Be able to set optimizeDeps options in gradio.config.js

View File

@ -40,7 +40,8 @@ export async function make_build({
},
build: {
target: []
}
},
optimizeDeps: {}
};
if (
@ -54,6 +55,7 @@ export async function make_build({
component_config.plugins = m.default.plugins || [];
component_config.svelte.preprocess = m.default.svelte?.preprocess || [];
component_config.build.target = m.default.build?.target || "modules";
component_config.optimizeDeps = m.default.optimizeDeps || {};
}
const exports: string[][] = [

View File

@ -60,6 +60,7 @@ export async function create_server({
build: {
target: config.build.target
},
optimizeDeps: config.optimizeDeps,
plugins: [
...plugins(config),
make_gradio_plugin({
@ -122,6 +123,7 @@ export interface ComponentConfig {
build: {
target: string | string[];
};
optimizeDeps: object;
}
async function generate_imports(
@ -147,7 +149,8 @@ async function generate_imports(
},
build: {
target: []
}
},
optimizeDeps: {}
};
await Promise.all(
@ -163,6 +166,7 @@ async function generate_imports(
component_config.plugins = m.default.plugins || [];
component_config.svelte.preprocess = m.default.svelte?.preprocess || [];
component_config.build.target = m.default.build?.target || "modules";
component_config.optimizeDeps = m.default.optimizeDeps || {};
} else {
}
})