🐛 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
const editorUiPath = require.resolve('n8n-editor-ui');
const filePath = pathJoin(pathDirname(editorUiPath), 'dist', 'index.html');
let readIndexFile = readFileSync(filePath, 'utf8');
const n8nPath = config.get('path');
let readIndexFile = readFileSync(filePath, 'utf8');
readIndexFile = readIndexFile.replace(/\/%BASE_PATH%\//g, n8nPath);
readIndexFile = readIndexFile.replace(/\/favicon.ico/g, `${n8nPath}/favicon.ico`);
// Serve the altered index.html file separately
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"
},
"scripts": {
"build": "vue-cli-service build",
"build": "cross-env VUE_APP_PUBLIC_PATH=\"/%BASE_PATH%/\" vue-cli-service build",
"dev": "npm run serve",
"lint": "vue-cli-service lint",
"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 http-equiv="X-UA-Compatible" content="IE=edge">
<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>
<title>n8n.io - Workflow Automation</title>
</head>
<body>
<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>
<div id="app"></div>
<!-- built files will be auto injected -->

View file

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

View file

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

View file

@ -39,7 +39,7 @@ export const store = new Vuex.Store({
activeActions: [] as string[],
activeNode: null as string | null,
// @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,
credentialTypes: null as ICredentialType[] | null,
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 : '/',
};