Skip to content

Commit 261b3ed

Browse files
committed
Stringify entire config object
1 parent eaff91b commit 261b3ed

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

packages/react-router-dev/vite/rsc/plugin.ts

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -516,17 +516,13 @@ export function reactRouterRSCVitePlugin(): Vite.PluginOption[] {
516516
const clientOutDir =
517517
resolvedViteConfig.environments.client?.build?.outDir;
518518
invariant(clientOutDir, "Client build directory config not found");
519-
const relativeAssetsBuildDirectory = Path.relative(
520-
rscOutDir,
521-
clientOutDir,
522-
);
519+
const assetsBuildDirectory = Path.relative(rscOutDir, clientOutDir);
520+
const publicPath = resolvedViteConfig.base;
523521

524-
let code = "";
525-
code += `export default {`;
526-
code += ` publicPath: ${JSON.stringify(resolvedViteConfig.base ?? "/")},`;
527-
code += ` assetsBuildDirectory: ${JSON.stringify(relativeAssetsBuildDirectory)},`;
528-
code += `};`;
529-
return code;
522+
return `export default ${JSON.stringify({
523+
assetsBuildDirectory,
524+
publicPath,
525+
})};`;
530526
}
531527
},
532528
},

0 commit comments

Comments
 (0)