Skip to content

Commit b745cad

Browse files
ivovautologie
andauthored
fix(editor): Account for subpath when serving config.js (#17832)
Co-authored-by: autologie <[email protected]>
1 parent a5184e4 commit b745cad

File tree

5 files changed

+5
-5
lines changed

5 files changed

+5
-5
lines changed

packages/cli/src/commands/start.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,6 @@ export class Start extends BaseCommand<z.infer<typeof flagsSchema>> {
147147
replaceStream('/{{BASE_PATH}}/', n8nPath, { ignoreCase: false }),
148148
replaceStream('/%7B%7BBASE_PATH%7D%7D/', n8nPath, { ignoreCase: false }),
149149
replaceStream('/%257B%257BBASE_PATH%257D%257D/', n8nPath, { ignoreCase: false }),
150-
replaceStream('/static/', n8nPath + 'static/', { ignoreCase: false }),
151150
];
152151
if (filePath.endsWith('index.html')) {
153152
streams.push(

packages/cli/src/server.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,6 @@ export class Server extends AbstractServer {
293293
release: `n8n@${N8N_VERSION}`,
294294
});
295295
const frontendConfig = [
296-
`window.BASE_PATH = '${this.globalConfig.path}';`,
297296
`window.REST_ENDPOINT = '${this.globalConfig.endpoints.rest}';`,
298297
`window.sentry = ${frontendSentryConfig};`,
299298
].join('\n');

packages/frontend/editor-ui/index.html

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,10 @@
55
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
66
<meta name="viewport" content="width=device-width,initial-scale=1.0" />
77
<link rel="icon" href="/favicon.ico" />
8-
<link rel="stylesheet" href="/static/prefers-color-scheme.css">
98
%CONFIG_SCRIPT%
10-
<script src="/static/posthog.init.js" type="text/javascript"></script>
9+
<link rel="stylesheet" href="/{{BASE_PATH}}/static/prefers-color-scheme.css">
10+
<script src="/{{BASE_PATH}}/static/base-path.js" type="text/javascript"></script>
11+
<script src="/{{BASE_PATH}}/static/posthog.init.js" type="text/javascript"></script>
1112

1213
<title>n8n.io - Workflow Automation</title>
1314
</head>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
window.BASE_PATH = '/{{BASE_PATH}}/';

packages/frontend/editor-ui/vite.config.mts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ const plugins: UserConfig['plugins'] = [
128128
transformIndexHtml: (html, ctx) => {
129129
const replacement = ctx.server
130130
? '' // Skip when using Vite dev server
131-
: '<script src="/{{REST_ENDPOINT}}/config.js"></script>';
131+
: '<script src="/{{BASE_PATH}}/{{REST_ENDPOINT}}/config.js"></script>';
132132

133133
return html.replace('%CONFIG_SCRIPT%', replacement);
134134
},

0 commit comments

Comments
 (0)