React-Devtool ์ค์น
TypeError : BrowserWindow.addDevToolsExtension์ ํจ์๊ฐ ์๋๋๋ค.
์๊ฐ์๋ด์ด์ด ๋ฌธ์ ๋ฅผ๋ณด๊ณ ํ๊ณ Electron์ ๊ฐ์ ํ๋ ๋ฐ ๋์์ ์ฃผ์ ์ ๊ฐ์ฌํฉ๋๋ค.
ํ ์คํฐ๊ฐ ๋ฌธ์ ๋ฅผ ์ฌํํ๊ธฐ ์ํด ์คํํ ์์๋ ๋ ๋ฆฝํ ํ ์คํธ๋ฅผ ์ ๊ณตํ์ธ์. ์ด๋ฅผ ํตํด ๋ฌธ์ ํด๊ฒฐ์ด ๋์ฑ ์ํํ๊ฒ ์งํ๋ฉ๋๋ค. ์ฌ๋ฐ๋ฅธ ํญ๋ชฉ์ ํ ์คํธ ํ ์์์๋ฟ๋ง ์๋๋ผ ํ ์คํฐ๊ฐ ์๋ก์ด ๊ฐ ๋ฌธ์ ์ ๋ํด ์ ํ ์คํธ๋ฅผ ์์ฑํ๋๋กํ๋ ๋ณ๋ชฉ ํ์์ ๋ฐฉ์งํฉ๋๋ค.
์์ ์ด์ ๋ก ๋ ๋ง์ ์ ๋ณด๊ฐ ํ์ํ ๋ ์ด๋ธ์ ์ค์ ํ๊ณ ์์ต๋๋ค. ์๋ต ํ ํ ํ์ ๋๊ธ์ @ me๋ฅผ ๋จ๊ฒจ์ฃผ์ธ์.
๋ฏธ๋ฆฌ ๊ฐ์ฌ๋๋ฆฝ๋๋ค! ๊ทํ์ ๋์์ ๊ฐ์ฌ๋๋ฆฝ๋๋ค.
์๋
ํ์ธ์.
main.js์ ์ค ๋ํซ์ด ํ์ํ์ง ๋ชจ๋ฅด๊ฒ ์ง๋ง ์ฌ๊ธฐ์ ์์ต๋๋ค.
const { app, BrowserWindow, ipcMain } = require('electron');
const path = require('path');
const url = require('url');
const scraper = require('./scraper.js');
const helpers = require('./electron/helpers.js');
const windowStateKeeper = require('electron-window-state');
const { autoUpdater } = require("electron-updater");
require('v8-compile-cache');
// for nodemon
process.env.IS_DEV ? require('electron-reload') : null;
// disable security warning
process.env['ELECTRON_DISABLE_SECURITY_WARNINGS'] = 'true';
// Application already running, so we close now
if (!app.requestSingleInstanceLock()) {
app.quit()
}
app.removeAllListeners('ready');
let mainWindow
function createWindow() {
// check for uppdate
autoUpdater.checkForUpdatesAndNotify();
// Load the previous state with fallback to defaults
let mainWindowState = windowStateKeeper({
defaultWidth: 1100,
defaultHeight: 600
});
mainWindow = new BrowserWindow({
'x': mainWindowState.x,
'y': mainWindowState.y,
'width': mainWindowState.width,
'height': mainWindowState.height,
minWidth: 1100,
minHeight: 500,
backgroundColor: '#121212',
frame: false,
icon: __dirname + '../build/icon.png',
webPreferences: {
webSecurity: false,
nodeIntegration: true,
webviewTag: true
},
});
// Let us register listeners on the window, so we can update the state
// automatically (the listeners will be removed when the window is closed)
// and restore the maximized or full screen state
mainWindowState.manage(mainWindow);
// http://localhost:3000
const startUrl = process.env.ELECTRON_START_URL || url.format({
pathname: path.join(__dirname, '../build/index.html'),
protocol: 'file:',
slashes: true,
});
mainWindow.loadURL(startUrl);
// in dev mode
if (process.env.ELECTRON_START_URL) {
// open devTools
mainWindow.webContents.openDevTools({ mode: 'undocked' });
}
// in build mode
if (process.env.IS_DEV) {
// close menubar
mainWindow.setMenuBarVisibility(false);
}
//clear session + cookies on start to avoid blocking requests
mainWindow.on('closed', () => {
mainWindow = null
});
mainWindow.webContents.on('new-window', function (e, url) {
e.preventDefault();
})
// Add React Devtool
if (app.isReady() && process.env.ELECTRON_START_URL) {
console.log('___INSTALL React Devtool_____')
BrowserWindow.addDevToolsExtension("./extensions/react")
.then(name => console.log('INSTALLING', name))
.catch(err => console.log('Install React-Devtool err', err));
}
}
app.setAppUserModelId('com.MyMovies.app');
app.on('ready', createWindow);
app.on('window-all-closed', () => {
app.quit();
})
Devtron, React ๋ฐ Redux ํ์ฅ์ ๋ชจ๋ ๋ธ๋ผ์ฐ์ ์ฐฝ์ ์ค์น๋์ง ์์ต๋๋ค. ๋๊ตฐ๊ฐ๊ฐ ํด๊ฒฐ ๋ฐฉ๋ฒ์ ์๊ณ ์๋ค๋ฉด ๋ฃ๊ณ ์ถ์ต๋๋ค.
[electron] Added Extension: React Developer Tools
[electron] Added Extension: Redux DevTools
[electron] [41948:0228/141801.424392:ERROR:CONSOLE(1)] "Uncaught TypeError: Cannot read[electron] [41948:0228/141801.424392:ERROR:CONSOLE(1)] "Uncaught TypeError: Cannot read property 'panels' of undefined", source: chrome-extension://redux-devtools/js/devtools.bundle.js (1)
[electron] [41948:0228/141801.512131:ERROR:CONSOLE(40)] "Uncaught TypeError: Cannot read property 'inspectedWindow' of undefined", source: chrome-extension://react-developer-tools/build/main.js (40)
[electron] Unable to create basic Accelerated OpenGL renderer.
[electron] Unable to create basic Accelerated OpenGL renderer.
[electron] Core Image is now using the software OpenGL renderer. This will be slow.
์ฐ๋ฆฌ๋ ํจํค์ง๋ฅผ ํตํด ์ฐ๋ฆฌ์ ์ ํ ๋ฆฌ์ผ์ด์ ์ ๋ฐ์ํ๊ณ REDUX ํ์ฅ์ ์ค์น ํ ์ ์์ต๋๋ค @ stevenroussey์-privicy ์ ์ DevTools๋ก-์ค์น @MarshallOfSound (๐ ๊ทธ ๋๋ถ์)ํ์ง๋ง DevTools๋ก ๋ง๋ ์ ์ค๋ฅ์ ๊ฐ์ ์ข ๋ฅ๋ก, ๋๋ก๋ ํ์๋์ง ์์ต๋๋ค .. .
[35280:0324/122320.140:ERROR:CONSOLE(1)] "Uncaught TypeError: Cannot read property 'panels' of undefined", source: chrome-extension://redux-devtools/js/devtools.bundle.js (1)
[35280:0324/122320.233:ERROR:CONSOLE(40)] "Uncaught TypeError: Cannot read property 'inspectedWindow' of undefined", source: chrome-extension://react-developer-tools/build/main.js (40)
Extension์ด BrowserWindow์๋ก๋ ๋ ํ ํ์ฅ ํญ์ด ์์ฑ ๋ ๊ฒ์ฒ๋ผ ๋๊ปด์ง๋๋ค. ๋ด๊ฐ ๋ฐฑ์๋์์ ์ก๋ ์ ์ผํ ์ค๋ฅ๋ ํฌ๋กฌ ์ ์ฅ์์ ๊ด๋ จ์ด ์์ง๋ง ๋ฌธ์ ์ ์์ธ์ ์๋ ์ ์์ต๋๋ค.
Exception has occurred: Error
Error: ENOENT: no such file or directory, open "\AppData\Roaming\AppName\Chrome Storage\redux-devtools-sync.json"
did-frame-finish-load
์ด๋ฒคํธ์์ devtools๋ฅผ ์ฝ๋ ๋ค.
win.webContents.on('did-frame-finish-load', () => {
win.webContents.openDevTools();
});
์ฐ๋ฆฌ๋ ๋์ผํ ์ค์น ๋ฐฉ๋ฒ์ ์ฌ์ฉํฉ๋๋ค. ์ ์ค์น๋์ง๋ง ์คํ๋์ง ์์ต๋๋ค. ๊ฐ์ ์ค๋ฅ. devtools๋ฅผ ์๋์ผ๋ก ์ด์ด๋ ํ์ด๋ฐ ๋ฌธ์ ๊ฐ ์๋๋๋ค.
์คํ๋์ ํ๋ฉด ์ฐฝ์ ์ฌ์ฉํฉ๋๋ค. ๋ด๊ฐ ์ ์ ์๋ฏ์ด ์ฒซ ๋ฒ์งธ ์ฐฝ์์๋ ์ ์๋ํ์ง๋ง ๋ค๋ฅธ ์ฐฝ์์๋ ์คํจํฉ๋๋ค. ๋ค๋ฅธ ์ฌ๋์ด ํ์ธํ ์ ์์ต๋๊น?
https://github.com/electron/electron/issues/23383 ๊ณผ ๊ด๋ จ์ด์์ ์ ์์ต๋๋ค.
๊ฐ์ฅ ์ ์ฉํ ๋๊ธ
Devtron, React ๋ฐ Redux ํ์ฅ์ ๋ชจ๋ ๋ธ๋ผ์ฐ์ ์ฐฝ์ ์ค์น๋์ง ์์ต๋๋ค. ๋๊ตฐ๊ฐ๊ฐ ํด๊ฒฐ ๋ฐฉ๋ฒ์ ์๊ณ ์๋ค๋ฉด ๋ฃ๊ณ ์ถ์ต๋๋ค.