오늘만살자

angular 적용하기 본문

Electron

angular 적용하기

오늘만살자 2018. 11. 16. 10:14

ng new my-app

cd my-app

npm i -D electron@latest


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": "my-app",
"version": "0.0.0", "main":"main.js",



package.json


"scripts": { "electron": "ng build --base-href ./ && electron .",




angular.json


"architect": {
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": { "outputPath": "dist",


'Electron' 카테고리의 다른 글

vue 설치  (0) 2019.10.08
앱 배포하기  (0) 2019.02.18
electron Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/electron/dist'  (0) 2018.12.11
bootstrap, jquery 추가하기  (0) 2017.11.30
asar 소스 노출 방지 배포  (0) 2017.11.30
Comments