Setup Visual Studio Code for debugging an Electron application with the Vue CLI Service

Setup Visual Studio Code for debugging an Electron application with the Vue CLI Service

This article builds on the article Create an Electron application with Vue and Vuetify. Please read the article first if you have never set up a project for an Electron application with Vue CLI before.

If you have created a project for an Electron application using the Vue CLI, it is not possible to debug the application with Visual Studio Code (e.g. with breakpoints) right out of the box.

This article builds on the article Create an Electron application with Vue and Vuetify. Please read the article first if you have never set up a project for an Electron application with Vue CLI before.

We can build the application for any platform (Windows, MacOS or Linux) with the following command:

npm run electron:build

After the command has finished, we will have an executable Electron application in the subfolder dist_electron/.

Also we can run the following command:

npm run electron:serve

This command will run the Electron application as a development server and we can debug it directly in the Electron application using the built-in developer tools.

This will work for most of the time, but in the long run an application grows, functions and processes become more complicated. In the end, output on the console will no longer suffice.

But for illustration we will prepare a simple example with an output to the console and afterwards debug it with the Visual Studio Code.

Debug with console.log(…)

This is one of the most common techniques and in most cases I can only advise against it. For a quick test, you can write some output to the console, but the danger is that you will forget to remove the output when you don’t need it anymore.

We modify the HelloWorld component (HelloWorld.vue ) a little bit. First we add a simple function to open a URL in a new window. Additionally we write the URL to the console.

Image for post

In the template section we update one of the v-for loops by using a click event instead of a href, which should call our method with the corresponding URL.

Image for post

change href to click-event

typescript nodejs vuejs vscode debugging

Bootstrap 5 Complete Course with Examples

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

Building a simple Applications with Vue 3

Deno Crash Course: Explore Deno and Create a full REST API with Deno

How to Build a Real-time Chat App with Deno and WebSockets

Convert HTML to Markdown Online

HTML entity encoder decoder Online

Build and Debug NodeJS Typescript with ONLY VSCODE

In this lesson we look at how you can #build and #debug a NodeJS application written in TypeScript using only VSCode

Hire NodeJs Developer

Looking to build dynamic, extensively featured, and full-fledged web applications? **[Hire NodeJs Developer](https://hourlydeveloper.io/hire-dedicated-node-js-developer/ "Hire NodeJs Developer")** to create a real-time, faster, and scalable...

Hire Dedicated VueJS Developers

Want to Hire VueJS Developer to develop an amazing app? **[Hire Dedicated VueJS Developers](https://hourlydeveloper.io/hire-dedicated-vue-js-developer/ "Hire Dedicated VueJS Developers")** on the contract (time/project) basis providing regular...

How to Restart the TypeScript NodeJS Application Fast

ts-node one of the best tool for NodeJS-Typescript development but when comes to typescript it doesn't do the best job.

Hire Nodejs Developer

Looking to **hire NodeJS Developer**[https://www.dataeximit.com/node-js-development/](https://www.dataeximit.com/node-js-development/ "https://www.dataeximit.com/node-js-development/") to build a perfect back-end to your website or...