Serve editor-ui correctly also when installed as package

This commit is contained in:
Jan Oberhauser 2019-08-19 20:41:10 +02:00
parent a3a11caa18
commit 6208125ac0
3 changed files with 7 additions and 1 deletions

View file

@ -1,4 +1,8 @@
import * as express from 'express';
import {
dirname as pathDirname,
join as pathJoin,
} from 'path';
import * as bodyParser from 'body-parser';
import * as history from 'connect-history-api-fallback';
import * as requestPromise from 'request-promise-native';
@ -1092,7 +1096,8 @@ class App {
// Serve the website
this.app.use('/', express.static(__dirname + '/../../node_modules/n8n-editor-ui/dist', { index: 'index.html' }));
const editorUiPath = require.resolve('n8n-editor-ui');
this.app.use('/', express.static(pathJoin(pathDirname(editorUiPath), 'dist'), { index: 'index.html' }));
}
}

View file

View file

@ -7,6 +7,7 @@
"name": "Jan Oberhauser",
"email": "jan@n8n.io"
},
"main": "index.js",
"repository": {
"type": "git",
"url": "git+https://github.com/n8n-io/n8n.git"