fix(core): Inline config.js to index.html to prevent CF from caching it (#18945)

This commit is contained in:
Tomi Turtiainen
2025-09-02 09:58:12 +03:00
committed by GitHub
parent 35e4772210
commit 17ce65a529
9 changed files with 352 additions and 31 deletions

View File

@@ -126,11 +126,9 @@ const plugins: UserConfig['plugins'] = [
{
name: 'Insert config script',
transformIndexHtml: (html, ctx) => {
const replacement = ctx.server
? '' // Skip when using Vite dev server
: '<script src="/{{BASE_PATH}}/{{REST_ENDPOINT}}/config.js"></script>';
return html.replace('%CONFIG_SCRIPT%', replacement);
// Skip config script when using Vite dev server. Otherwise the BE
// will replace it with the actual config script in cli/src/commands/start.ts.
return ctx.server ? html.replace('%CONFIG_SCRIPT%', '') : html;
},
},
// For sanitize-html