Skip to content

Commit

Permalink
Proper ssr build
Browse files Browse the repository at this point in the history
  • Loading branch information
freddyaboulton committed Oct 7, 2024
1 parent ce47589 commit 7acc243
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions js/app/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const version = version_raw.replace(/\./g, "-");
const GRADIO_VERSION = version_raw || "asd_stub_asd";
const CDN_BASE = "https://gradio.s3-us-west-2.amazonaws.com";

export default defineConfig(({ mode, isSsrBuild }) => {
export default defineConfig(({ mode }) => {
const production = mode === "production";
const development = mode === "development";
return {
Expand Down Expand Up @@ -96,15 +96,14 @@ export default defineConfig(({ mode, isSsrBuild }) => {
inject_component_loader({ mode }),
{name: "resolve_svelte",
enforce: "pre",
resolveId(id) {
console.log("$$isSSrBuild", isSsrBuild);
if(!isSsrBuild){
// if (id === "svelte" || id === "svelte/internal") {
// return { id: "./svelte.js", external: true };
// }
// if (id.startsWith("svelte/")) {
// return { id: "./svelte/svelte-submodules.js", external: true };
// }
resolveId(id, importer, options) {
if(!options?.ssr){
if (id === "svelte" || id === "svelte/internal") {
return { id: "./svelte.js", external: true };
}
if (id.startsWith("svelte/")) {
return { id: "./svelte/svelte-submodules.js", external: true };
}
}
}
}
Expand Down

0 comments on commit 7acc243

Please sign in to comment.