集成服务端

This commit is contained in:
zilong
2021-10-26 19:52:38 +08:00
parent e766634a42
commit bb6588ec05
5 changed files with 30 additions and 6 deletions

View File

@@ -1,9 +1,18 @@
// electron/electron.js
const path = require('path');
const { app, BrowserWindow } = require('electron');
let exec = require('child_process').exec;
const isDev = process.env.IS_DEV == "true" ? true : false;
//计算NMApi路径
let NMApiPath = isDev ? '../NMApi.asar' : path.join(process.resourcesPath, 'NMApi.asar')
let p = require('path').join(NMApiPath + '/node_modules');
require('module').globalPaths.unshift(p); //加入到module的路径列表
console.log(process.resourcesPath, NMApiPath)
const svc = require(NMApiPath + '/app.js')
function createWindow() {
// Create the browser window.
const mainWindow = new BrowserWindow({
@@ -19,7 +28,7 @@ function createWindow() {
// win.loadFile("index.html");
mainWindow.loadURL(
isDev
? 'http://localhost:3000'
? 'http://localhost:3301'
: `file://${path.join(__dirname, '../dist/index.html')}`
);
// Open the DevTools.