Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Sep 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/cli/src/Server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion packages/editor-ui/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
2 changes: 1 addition & 1 deletion packages/editor-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion packages/editor-ui/src/router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion packages/editor-ui/src/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
2 changes: 1 addition & 1 deletion packages/editor-ui/vue.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 ?? '/',
};