Electron - 如何添加反应开发工具 [英] Electron - How to add react dev tool
问题描述
将反应开发工具添加到电子窗口的简单方法是什么?我尝试添加扩展哈希
What is the easy way to add react dev tool to electron window? I try add the extension hash
BrowserWindow.addDevToolsExtension('path/to/extension/ade2343nd23k234bdb').15.01
但是当扩展更新时,我不得不手动更新 main.js 中的字符串.我正在寻找更好的方法.
But when the extension update, I had to manually update the string in main.js. I'm looking for a better way.
推荐答案
这里是 Electron <= 1.2.1 版本的解决方案
Here is a Solution for Electron <= 1.2.1 version
1- 在您的应用文件夹中
1- In your app folder
npm install --save-dev electron-react-devtools
2- 打开您的电子应用程序,单击(查看/切换开发人员工具).在 console 选项卡中插入以下代码并回车:
2- Open your electron app, click on (view/toggle developer tools). In the console tab insert the following code and hit enter:
require('electron-react-devtools').install()
3- 重新加载/刷新您的电子应用页面,您将看到反应开发工具出现.
3- Reload/refresh your electron app page and you'll see the react dev tools appear.
4- 完成!
请参阅下面的屏幕截图
这篇关于Electron - 如何添加反应开发工具的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!