diff --git a/packages/cli/src/commands/start.ts b/packages/cli/src/commands/start.ts index 8673f7c91c..f54e22ece0 100644 --- a/packages/cli/src/commands/start.ts +++ b/packages/cli/src/commands/start.ts @@ -13,6 +13,8 @@ import replaceStream from 'replacestream'; import { pipeline } from 'stream/promises'; import { z } from 'zod'; +import { BaseCommand } from './base-command'; + import { ActiveExecutions } from '@/active-executions'; import { ActiveWorkflowManager } from '@/active-workflow-manager'; import config from '@/config'; @@ -32,8 +34,6 @@ import { UrlService } from '@/services/url.service'; import { WaitTracker } from '@/wait-tracker'; import { WorkflowRunner } from '@/workflow-runner'; -import { BaseCommand } from './base-command'; - // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment const open = require('open'); @@ -164,9 +164,8 @@ export class Start extends BaseCommand> { } }; - await compileFile('index.html'); const files = await glob('**/*.{css,js}', { cwd: EDITOR_UI_DIST_DIR }); - await Promise.all(files.map(compileFile)); + await Promise.all([compileFile('index.html'), ...files.map(compileFile)]); } async init() { diff --git a/packages/cli/src/server.ts b/packages/cli/src/server.ts index 3ddda10fb2..bd6a10fc1c 100644 --- a/packages/cli/src/server.ts +++ b/packages/cli/src/server.ts @@ -1,3 +1,4 @@ +import { CLI_DIR, EDITOR_UI_DIST_DIR, inE2ETests, N8N_VERSION } from '@/constants'; import { inDevelopment, inProduction } from '@n8n/backend-common'; import { SecurityConfig } from '@n8n/config'; import { Time } from '@n8n/constants'; @@ -14,7 +15,6 @@ import { resolve } from 'path'; import { AbstractServer } from '@/abstract-server'; import config from '@/config'; -import { CLI_DIR, EDITOR_UI_DIST_DIR, inE2ETests, N8N_VERSION } from '@/constants'; import { ControllerRegistry } from '@/controller.registry'; import { CredentialsOverwrites } from '@/credentials-overwrites'; import { MessageEventBus } from '@/eventbus/message-event-bus/message-event-bus'; @@ -278,19 +278,21 @@ export class Server extends AbstractServer { ResponseHelper.send(async () => frontendService.getModuleSettings()), ); - // Return Sentry config as a static file - this.app.get(`/${this.restEndpoint}/sentry.js`, (_, res) => { - res.type('js'); - res.write('window.sentry='); - res.write( - JSON.stringify({ - dsn: this.globalConfig.sentry.frontendDsn, - environment: process.env.ENVIRONMENT || 'development', - serverName: process.env.DEPLOYMENT_NAME, - release: `n8n@${N8N_VERSION}`, - }), - ); - res.end(); + this.app.get(`/${this.restEndpoint}/config.js`, (_req, res) => { + const frontendSentryConfig = JSON.stringify({ + dsn: this.globalConfig.sentry.frontendDsn, + environment: process.env.ENVIRONMENT || 'development', + serverName: process.env.DEPLOYMENT_NAME, + release: `n8n@${N8N_VERSION}`, + }); + const frontendConfig = [ + `window.BASE_PATH = '${this.globalConfig.path}';`, + `window.REST_ENDPOINT = '${this.globalConfig.endpoints.rest}';`, + `window.sentry = ${frontendSentryConfig};`, + ].join('\n'); + + res.type('application/javascript'); + res.send(frontendConfig); }); } diff --git a/packages/frontend/editor-ui/index.html b/packages/frontend/editor-ui/index.html index 25bbde030f..3d7d4a75af 100644 --- a/packages/frontend/editor-ui/index.html +++ b/packages/frontend/editor-ui/index.html @@ -6,11 +6,7 @@ - - + n8n.io - Workflow Automation