diff --git a/packages/cli/src/Server.ts b/packages/cli/src/Server.ts index eb5da9492c86e..7b561f86eee6f 100644 --- a/packages/cli/src/Server.ts +++ b/packages/cli/src/Server.ts @@ -1800,7 +1800,7 @@ class App { const srcFile = await readFile(filePath, 'utf8'); let payload = srcFile .replace(basePathRegEx, n8nPath) - .replace(/\/static\//g, pathJoin(n8nPath, 'static/')); + .replace(/\/static\//g, n8nPath + 'static/'); if (filePath.endsWith('index.html')) { payload = payload.replace(closingTitleTag, closingTitleTag + scriptsString); } diff --git a/packages/editor-ui/src/router.ts b/packages/editor-ui/src/router.ts index 24359f0d45651..ca2944998a923 100644 --- a/packages/editor-ui/src/router.ts +++ b/packages/editor-ui/src/router.ts @@ -55,8 +55,7 @@ function getTemplatesRedirect(store: Store) { const router = new Router({ mode: 'history', - // @ts-ignore - base: window.BASE_PATH ?? '/', + base: import.meta.env.DEV ? '/' : window.BASE_PATH ?? '/', scrollBehavior(to, from, savedPosition) { // saved position == null means the page is NOT visited from history (back button) if (savedPosition === null && to.name === VIEWS.TEMPLATES && to.meta) { diff --git a/packages/editor-ui/src/shims.d.ts b/packages/editor-ui/src/shims.d.ts index 467ca274f144d..eb1c83fcddccb 100644 --- a/packages/editor-ui/src/shims.d.ts +++ b/packages/editor-ui/src/shims.d.ts @@ -5,6 +5,10 @@ declare module 'markdown-it-emoji'; declare module 'markdown-it-task-lists'; declare global { + interface Window { + BASE_PATH: string; + } + namespace JSX { // tslint:disable no-empty-interface interface Element extends VNode {}