fix(editor-ui): fix BASE_URL replacement on windows (#4202)

This commit is contained in:
कारतोफ्फेलस्क्रिप्ट™ 2022-09-27 07:02:41 +02:00 committed by GitHub
parent b809a2a074
commit 5f0c65690b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 6 additions and 6 deletions

View file

@ -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);

View file

@ -5,7 +5,7 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<link rel="icon" href="/favicon.ico">
<script type="text/javascript">window.BASE_PATH = "/%BASE_PATH%/";</script>
<script type="text/javascript">window.BASE_PATH = "/{{BASE_PATH}}/";</script>
<title>n8n.io - Workflow Automation</title>
</head>
<body>

View file

@ -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",

View file

@ -56,7 +56,7 @@ function getTemplatesRedirect(store: Store<IRootState>) {
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) {

View file

@ -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',

View file

@ -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 ?? '/',
};