방금 전자를 발견했고 흥미 롭다는 것을 알았으므로 jhipster angular 프로젝트 (최신 jhipster 버전)에서 구현하고 싶습니다.
이 튜토리얼을 따라 시도하고 수정했지만 Jhipster가 Webpack을 사용하기 때문에 내 빌드가 좋지 않다고 생각합니다.
여기 내가 한 일이 있습니다
다음과 같이 src / main / webapp 폴더 에 main.js 파일을 선언했습니다.
const { app, BrowserWindow } = require("electron");
const path = require("path");
const url = require("url");
let win;
function createWindow() {
win = new BrowserWindow({ width: 800, height: 600 });
// load the dist folder from Angular
win.loadURL(
url.format({
pathname: path.join(__dirname, `/dist/index.html`),
protocol: "file:",
slashes: true
})
);
// The following is optional and will open the DevTools:
// win.webContents.openDevTools()
win.on("closed", () => {
win = null;
});
}
app.on("ready", createWindow);
// on macOS, closing the window doesn't quit the app
app.on("window-all-closed", () => {
if (process.platform !== "darwin") {
app.quit();
}
});
// initialize the app's main window
app.on("activate", () => {
if (win === null) {
createWindow();
}
});
그런 다음 아래 구성 파일을 업데이트하려고 시도했습니다.
package.json
{
"name": "boxing",
"version": "0.0.1-SNAPSHOT",
"main": "main.js", <-- added this
"description": "Description for boxing",
"private": true,
"license": "UNLICENSED",
"cacheDirectories": [
"node_modules"
],
"dependencies": {
"@angular-devkit/build-angular": "^0.803.14", <-- installed using npm
...
"scripts": {
"electron": "ng build --base-href ./ && electron .",
angular.json
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"newProjectRoot": "projects",
"projects": {
"boxing": {
"root": "",
"sourceRoot": "src/main/webapp",
"projectType": "application",
"schematics": {
"@schematics/angular:component": {
"skipTests": true,
"style": "scss"
},
"@schematics/angular:directive": {
"skipTests": true
},
"@schematics/angular:guard": {
"skipTests": true
},
"@schematics/angular:pipe": {
"skipTests": true
},
"@schematics/angular:service": {
"skipTests": true
}
},
"prefix": "jhi",
"architect": {
<-- added this lines
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"outputPath": "dist"
}
}
<-- end of add
}
}
},
"defaultProject": "boxing",
"cli": {
"packageManager": "npm"
}
}
마침내 index.html href를 ./로 업데이트 했습니다 .
하지만 터미널에서 명령을 실행하면이 오류가 발생합니다.
npm 실행 전자
[email protected] electron / home / housseyn / Desktop / projects / salle-de-sport ng build --base-href ./ && electron.
다음 오류로 인해 스키마 유효성 검사에 실패했습니다. 데이터 경로 ""에 필수 속성 'main'이 있어야합니다. npm 오류! 코드 ELIFECYCLE npm ERR! errno 1 npm ERR! [email protected] 전자 :
ng build --base-href ./ && electron .
npm ERR! 종료 상태 1 npm ERR! npm 오류! [email protected] 전자 스크립트에서 실패했습니다. npm 오류! 이것은 아마도 npm의 문제가 아닙니다. 위의 추가 로깅 출력이있을 수 있습니다.npm 오류! 이 실행에 대한 전체 로그는 npm ERR!에서 찾을 수 있습니다. /home/housseyn/.npm/_logs/2019-10-25T16_00_19_675Z-debug.log
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다