refactor(editor): Simplify config script insertion in dev mode (#18947)

This commit is contained in:
Suguru Inoue
2025-09-02 11:49:10 +02:00
committed by GitHub
parent 2ba544284f
commit a10a14bc79

View File

@@ -126,9 +126,14 @@ const plugins: UserConfig['plugins'] = [
{
name: 'Insert config script',
transformIndexHtml: (html, ctx) => {
// Skip config script when using Vite dev server. Otherwise the BE
// Skip config tags 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;
return ctx.server
? html
.replace('%CONFIG_TAGS%', '')
.replaceAll('/{{BASE_PATH}}', '//localhost:5678')
.replaceAll('/{{REST_ENDPOINT}}', '/rest')
: html;
},
},
// For sanitize-html