From 0548f96b19804de16a21d72a79313a1a733fb11a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E0=A4=95=E0=A4=BE=E0=A4=B0=E0=A4=A4=E0=A5=8B=E0=A4=AB?= =?UTF-8?q?=E0=A5=8D=E0=A4=AB=E0=A5=87=E0=A4=B2=E0=A4=B8=E0=A5=8D=E0=A4=95?= =?UTF-8?q?=E0=A5=8D=E0=A4=B0=E0=A4=BF=E0=A4=AA=E0=A5=8D=E0=A4=9F=E2=84=A2?= Date: Mon, 26 Sep 2022 18:23:23 +0200 Subject: [PATCH] fix(editor-ui): fix `BASE_URL` replacement on windows --- packages/cli/src/Server.ts | 2 +- packages/editor-ui/index.html | 2 +- packages/editor-ui/package.json | 2 +- packages/editor-ui/src/router.ts | 2 +- packages/editor-ui/src/store.ts | 2 +- packages/editor-ui/vue.config.js | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/cli/src/Server.ts b/packages/cli/src/Server.ts index b74f59b159f93..d3c8042f35e50 100644 --- a/packages/cli/src/Server.ts +++ b/packages/cli/src/Server.ts @@ -1755,7 +1755,7 @@ class App { const editorUiPath = require.resolve('n8n-editor-ui'); const filePath = pathJoin(pathDirname(editorUiPath), 'dist', 'index.html'); const n8nPath = config.getEnv('path'); - const basePathRegEx = /\/%BASE_PATH%\//g; + const basePathRegEx = /\/{{BASE_PATH}}\//g; let readIndexFile = readFileSync(filePath, 'utf8'); readIndexFile = readIndexFile.replace(basePathRegEx, n8nPath); diff --git a/packages/editor-ui/index.html b/packages/editor-ui/index.html index db45137ef59e8..2eea7165e0a48 100644 --- a/packages/editor-ui/index.html +++ b/packages/editor-ui/index.html @@ -5,7 +5,7 @@ - + n8n.io - Workflow Automation diff --git a/packages/editor-ui/package.json b/packages/editor-ui/package.json index 6287452534f64..60fa14de6ba2f 100644 --- a/packages/editor-ui/package.json +++ b/packages/editor-ui/package.json @@ -14,7 +14,7 @@ "url": "git+https://github.com/n8n-io/n8n.git" }, "scripts": { - "build": "cross-env VUE_APP_PUBLIC_PATH=\"/%BASE_PATH%/\" NODE_OPTIONS=\"--max-old-space-size=8192\" vite build", + "build": "cross-env VUE_APP_PUBLIC_PATH=\"/{{BASE_PATH}}/\" NODE_OPTIONS=\"--max-old-space-size=8192\" vite build", "dev": "npm run serve", "lint": "tslint -p tsconfig.json -c tslint.json && eslint .", "lintfix": "tslint --fix -p tsconfig.json -c tslint.json && eslint . --fix", diff --git a/packages/editor-ui/src/router.ts b/packages/editor-ui/src/router.ts index 5babd669d18ad..d5f8cc368cb9b 100644 --- a/packages/editor-ui/src/router.ts +++ b/packages/editor-ui/src/router.ts @@ -56,7 +56,7 @@ function getTemplatesRedirect(store: Store) { const router = new Router({ mode: 'history', // @ts-ignore - base: window.BASE_PATH === '/%BASE_PATH%/' ? '/' : window.BASE_PATH, + base: window.BASE_PATH === '/{{BASE_PATH}}/' ? '/' : 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/store.ts b/packages/editor-ui/src/store.ts index 449bbbac8937c..1cd2f24ab1f01 100644 --- a/packages/editor-ui/src/store.ts +++ b/packages/editor-ui/src/store.ts @@ -59,7 +59,7 @@ const state: IRootState = { activeNode: null, activeCredentialType: null, // @ts-ignore - baseUrl: import.meta.env.VUE_APP_URL_BASE_API ? import.meta.env.VUE_APP_URL_BASE_API : (window.BASE_PATH === '/%BASE_PATH%/' ? '/' : window.BASE_PATH), + baseUrl: import.meta.env.VUE_APP_URL_BASE_API ? import.meta.env.VUE_APP_URL_BASE_API : (window.BASE_PATH === '/{{BASE_PATH}}/' ? '/' : window.BASE_PATH), defaultLocale: 'en', endpointWebhook: 'webhook', endpointWebhookTest: 'webhook-test', diff --git a/packages/editor-ui/vue.config.js b/packages/editor-ui/vue.config.js index db1cd795fccb8..eb15513032dde 100644 --- a/packages/editor-ui/vue.config.js +++ b/packages/editor-ui/vue.config.js @@ -44,5 +44,5 @@ module.exports = { }, }, }, - publicPath: process.env.VUE_APP_PUBLIC_PATH ? process.env.VUE_APP_PUBLIC_PATH : '/', + publicPath: process.env.VUE_APP_PUBLIC_PATH ?? '/', };