🐛 Fix editor-ui build

This commit is contained in:
Jan Oberhauser
2020-07-14 23:36:05 +02:00
parent df3077b5d2
commit 25cc745894
7 changed files with 10 additions and 8 deletions

View File

@@ -1711,9 +1711,11 @@ class App {
// Read the index file and replace the path placeholder // Read the index file and replace the path placeholder
const editorUiPath = require.resolve('n8n-editor-ui'); const editorUiPath = require.resolve('n8n-editor-ui');
const filePath = pathJoin(pathDirname(editorUiPath), 'dist', 'index.html'); const filePath = pathJoin(pathDirname(editorUiPath), 'dist', 'index.html');
let readIndexFile = readFileSync(filePath, 'utf8');
const n8nPath = config.get('path'); const n8nPath = config.get('path');
let readIndexFile = readFileSync(filePath, 'utf8');
readIndexFile = readIndexFile.replace(/\/%BASE_PATH%\//g, n8nPath); readIndexFile = readIndexFile.replace(/\/%BASE_PATH%\//g, n8nPath);
readIndexFile = readIndexFile.replace(/\/favicon.ico/g, `${n8nPath}/favicon.ico`);
// Serve the altered index.html file separately // Serve the altered index.html file separately
this.app.get(`/index.html`, async (req: express.Request, res: express.Response) => { this.app.get(`/index.html`, async (req: express.Request, res: express.Response) => {

View File

@@ -14,7 +14,7 @@
"url": "git+https://github.com/n8n-io/n8n.git" "url": "git+https://github.com/n8n-io/n8n.git"
}, },
"scripts": { "scripts": {
"build": "vue-cli-service build", "build": "cross-env VUE_APP_PUBLIC_PATH=\"/%BASE_PATH%/\" vue-cli-service build",
"dev": "npm run serve", "dev": "npm run serve",
"lint": "vue-cli-service lint", "lint": "vue-cli-service lint",
"serve": "cross-env VUE_APP_URL_BASE_API=http://localhost:5678/ vue-cli-service serve", "serve": "cross-env VUE_APP_URL_BASE_API=http://localhost:5678/ vue-cli-service serve",

View File

@@ -4,13 +4,13 @@
<meta charset="utf-8"> <meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0"> <meta name="viewport" content="width=device-width,initial-scale=1.0">
<link rel="icon" href="/%BASE_PATH%/favicon.ico"> <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> <title>n8n.io - Workflow Automation</title>
</head> </head>
<body> <body>
<noscript> <noscript>
<strong>We're sorry but editor-ui-ts-default-lint doesn't work properly without JavaScript enabled. Please enable it to continue.</strong> <strong>We're sorry but the n8n Editor-UI doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
</noscript> </noscript>
<div id="app"></div> <div id="app"></div>
<!-- built files will be auto injected --> <!-- built files will be auto injected -->

View File

@@ -209,7 +209,7 @@ export default mixins(
return { return {
aboutDialogVisible: false, aboutDialogVisible: false,
// @ts-ignore // @ts-ignore
basePath: window.BASE_PATH, basePath: this.$store.getters.getBaseUrl,
isCollapsed: true, isCollapsed: true,
credentialNewDialogVisible: false, credentialNewDialogVisible: false,
credentialOpenDialogVisible: false, credentialOpenDialogVisible: false,

View File

@@ -9,7 +9,7 @@ Vue.use(Router);
export default new Router({ export default new Router({
mode: 'history', mode: 'history',
// @ts-ignore // @ts-ignore
base: window.BASE_PATH, base: window.BASE_PATH === '/%BASE_PATH%/' ? '/' : window.BASE_PATH,
routes: [ routes: [
{ {
path: '/execution/:id', path: '/execution/:id',

View File

@@ -39,7 +39,7 @@ export const store = new Vuex.Store({
activeActions: [] as string[], activeActions: [] as string[],
activeNode: null as string | null, activeNode: null as string | null,
// @ts-ignore // @ts-ignore
baseUrl: window.BASE_PATH ? window.BASE_PATH : '/', baseUrl: process.env.VUE_APP_URL_BASE_API ? process.env.VUE_APP_URL_BASE_API : (window.BASE_PATH === '/%BASE_PATH%/' ? '/' : window.BASE_PATH),
credentials: null as ICredentialsResponse[] | null, credentials: null as ICredentialsResponse[] | null,
credentialTypes: null as ICredentialType[] | null, credentialTypes: null as ICredentialType[] | null,
endpointWebhook: 'webhook', endpointWebhook: 'webhook',

View File

@@ -29,5 +29,5 @@ module.exports = {
}, },
}, },
}, },
publicPath: process.env.VUE_APP_PUBLIC_PATH ? process.env.VUE_APP_PUBLIC_PATH : '/%BASE_PATH%/', publicPath: process.env.VUE_APP_PUBLIC_PATH ? process.env.VUE_APP_PUBLIC_PATH : '/',
}; };