You can select any port you like.)Īlternatively, run the application from the command line with the -remote-debugging-port=9222 option or use an npm script. Open the previously created Node.js configuration for the main process or create a new one and add the -remote-debugging-port=9222 additional option in the Application parameters field. For a built Windows app it’s your_app-win32-圆4/your_app.exe. You can also debug packaged Electron apps – just make sure you specify the path to Electron inside the built app in the Node.js run/debug configuration.įor example, for a built macOS app, that would be your_app.app/Contents/MacOS/your_app. Save the configuration, set the breakpoints, and click Debug on the toolbar. You can also specify the path to a globally installed electron package. If you installed Electron locally, the executable is located in your node_modules project under the. The Electron executable is what you use to start your Electron app from the command line: electron for macOS and Linux or electron.cmd for Windows. as a Node parameter (because we need to run electron. If you want to see what happens on application start, you need to debug the main process.Ĭreate a new run/debug configuration of the type Node.js, specify the path to the Electron executable in the Node interpreter field, and add. In Electron, there are 2 types of processes: the main process, which manages the web pages of your application and handles system events, and the render process, which is related to every individual page of the app and hosts most of the application logic. To get code completion for Node.js APIs, go to Preferences / Settings | Languages and Frameworks | Node.js and click Coding assistance for Node.js. You can also download the file manually from GitHub and link to it.Īfter you restart the IDE, coding assistance for Electron will work, although it will not be listed among the project dependencies: Then specify the path to the electron.d.ts file located in the global node_modules/electron folder: In the New Library dialog that appears, click and select Attach Files: To do so, go to Preferences / Settings | Languages and Frameworks | JavaScript | Libraries and click Add. To get the proper code completion in this case, you need to add electron.d.ts as a JavaScript library. If Electron is installed as a global dependency, electron.d.ts will not be detected: If you’ve installed Electron as a project dependency (with $npm install –save-dev electron), WebStorm will automatically locate electron.d.ts in the node_modules folder. Starting with Electron v1.6.9, this file is included in the electron node module. The coding assistance for the Electron APIs is provided via the electron.d.ts TypeScript definition file. How to debug an Electron application built with webpack.How to debug an Electron application written in TypeScript.How to run and debug an Electron application.How to enable the coding assistance for Electron in your application.There are several well-known apps that use Electron, for example Slack and Visual Studio Code, as well as a great number of open-source apps built on Electron that you can learn from. It provides lots of native OS APIs for things like OS notifications or automatic updates. To run the new configuration, select Run > Debug ‘DevWeb Script’.Note: This post was updated in June 2022.Įlectron allows you to build cross platform applications using only HTML, CSS, JavaScript, or any other language that compiles to JavaScript.The results are displayed in the bottom panel. Select Tools > External Tools > Inspect DevWeb. Click the button to add a new configuration.To configure and activate the debugger in WebStorm: Use the WebStorm debugger to debug your DevWeb scripts. To run the script again, click the green Run button. Select Tools > External Tools > Run DevWeb. To enable the web inspector for scripts in WebStorm:īack to top Run DevWeb scripts from WebStorm To enable script execution on macOS in WebStorm: To enable script execution on Windows in WebStorm: Select Tools > External tools, and click the button. (On a macOS, select WebStorm > Preference.) To configure WebStorm to use the DevWeb executable: When scripting with WebStorm, you can execute and inspect the script using the DevWeb executable, as described in the steps below. In the Project view, under the MyDevWebProject project, open main.js to start writing your code.īack to top Enable WebStorm to execute and inspect scripts.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |