๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ
  • What would life be If we had no courage to attemp anything?
Development/Electron

[Electron] electron ์•„์ด์ฝ˜ ๋„ฃ๊ธฐ

by DevIseo 2023. 1. 25.
//๋””๋ ‰ํ† ๋ฆฌ์— ์•„์ด์ฝ˜ ํŒŒ์ผ์„ ๋„ฃ์€ ๋’ค ์„ค์ •

//electron.js - ๋ฉ”์ธํ”„๋กœ์„ธ์„œ ํŒŒ์ผ
const {app, BrowserWindow,ipcMain} = require('electron')
const path = require('path')

// const fs = require("fs");

function createWindow () {
  const mainWindow = new BrowserWindow({
    width: 528,
    height: 791,
    resizable:false,  //size ๊ณ ์ •
    useContentSize :true, //๊ฐ€์šด๋ฐ ์„ค์ •
    center:true, //์•ฑ ์‹คํ–‰์‹œ ์œˆ๋„์šฐ๋ฅผ ํ™”๋ฉด ์ •์ค‘์•™์— ์œ„์น˜
    **icon:path.join(__dirname,'[๋กœ๊ณ  path]'), //์ผ๋ ‰ํŠธ๋ก  ์•ฑ ๋กœ๊ณ  ๋ณ€๊ฒฝ**

    //ELECTRON ์›น ํ™˜๊ฒฝ์„ค์ •
    webPreferences: {
      preload: path.join(__dirname, 'preload.js'), //์ ˆ๋Œ€๊ฒฝ๋กœ
      webSecurity: false, //CORS ์—๋Ÿฌ ๋ฐฉ์ง€

      // TypeError: window.require is not a function ์ผ๋•Œ ์ถ”๊ฐ€\\
      nodeIntegration: false,
      enableRemoteModule: false,
      contextIsolation: true, //preload.js์—์„œ ContextBridge๋ฅผ ์‚ฌ์šฉํ•˜๊ธฐ ์œ„ํ•จ
      
      showMessageBox:true,
    }
  })
}

Reference

https://inote.gitlab.io/2017/Electron%20App%20Icon%20%EB%B3%80%EA%B2%BD%ED%95%98%EA%B8%B0/

'Development > Electron' ์นดํ…Œ๊ณ ๋ฆฌ์˜ ๋‹ค๋ฅธ ๊ธ€

[Electron] ipcRenderer.invoke & ipcMin.handle  (0) 2023.06.15
[Electron] dialog.showOpenDialog()  (0) 2023.06.15
[Electron] Electron + React ์—ฐ๋™ํ•˜๊ธฐ  (0) 2023.01.13
[Electron]Electron-forge  (0) 2023.01.12
[Electron]Electron  (0) 2023.01.11

๋Œ“๊ธ€