Reader small image

You're reading from  Frontend Development Projects with Vue.js 3 - Second Edition

Product typeBook
Published inMar 2023
Reading LevelIntermediate
PublisherPackt
ISBN-139781803234991
Edition2nd Edition
Languages
Tools
Right arrow
Authors (4):
Maya Shavin
Maya Shavin
author image
Maya Shavin

Maya is Senior Software Engineer in Microsoft, working extensively with JavaScript and frontend frameworks and based in Israel. She holds a B.Sc in Computer Sciences, B.A in Business Management, and an International MBA from University of Bar-Ilan, Israel. She has worked with JavaScript and latest frontend frameworks such as React, Vue.js, etc to create scalable and performant front-end solutions at companies such as Cooladata and Cloudinary, and currently Microsoft. She founded and is currently the organizer of the VueJS Israel Meetup Community, helping to create a strong playground for Vue.js lovers and like-minded developers. Maya is also a published author, international speaker and an open-source library maintainer of frontend and web projects.
Read more about Maya Shavin

Raymond Camden
Raymond Camden
author image
Raymond Camden

Raymond Camden is a developer advocate for IBM. His work focuses on the MobileFirst platform, Bluemix, hybrid mobile development, Node.js, HTML5, and web standards in general. He is a published author and presents at conferences and user groups on a variety of topics. Raymond can be reached at his blog, on Twitter, or via email. He is the author of many development books, including Apache Cordova in Action and Client-Side Data Storage.
Read more about Raymond Camden

Clifford Gurney
Clifford Gurney
author image
Clifford Gurney

Clifford Gurney is a solution-focused and results-oriented technical lead at a series-A funded startup. A background in communication design and broad exposure to leading digital transformation initiatives enriches his delivery of conceptually designed front-end solutions using Vue JS. Cliff has presented at the Vue JS Melbourne meetups and collaborates with other like-minded individuals to deliver best in class digital experience platforms.
Read more about Clifford Gurney

Hugo Di Francesco
Hugo Di Francesco
author image
Hugo Di Francesco

Hugo Di Francesco is a software engineer who has worked extensively with JavaScript. He holds a MEng degree in mathematical computation from University College London (UCL). He has used JavaScript across the stack to create scalable and performant platforms at companies such as Canon and Elsevier and in industries such as print on demand and mindfulness. He is currently tackling problems in the travel industry at Eurostar with Node.js, TypeScript, React, and Kubernetes while running the eponymous Code with Hugo website. Outside of work, he is an international fencer, in the pursuit of which he trains and competes across the globe.
Read more about Hugo Di Francesco

View More author details
Right arrow

Vite and Vue Devtools

In the previous chapter, you learned how to utilize the Vue component’s data reactivity and query the external data into the component’s data system using methods, computed properties, and watch properties. This chapter introduces Vite and shows you how to debug these computed properties and events using Vue Devtools.

We will cover the following topics in the chapter:

  • Using Vite
  • Using Vue Devtools

Technical requirements

It would be best to have your Node.js version at least 14.18+ or 16+ and above. To check your Node version, run the following command in Command Prompt (or PowerShell):

node -v

You should have your npm version to 7.x and above since all our commands in the chapter are compatible with npm 7.x, and there is a slight difference with 6.x. And finally, you should install Yarn as our primary package management tool throughout the chapter.

The complete code for this chapter is available on GitHub at: https://github.com/PacktPublishing/Frontend-Development-Projects-with-Vue.js-3/tree/v2-edition/Chapter03

Using Vite

Vite.js is the build management tool aiming to do the following:

  • Help you develop faster (locally develop your project with a more time-saving approach)
  • Build with optimization (bundle files for production with better performance)
  • Manage other aspects of your web project effectively (testing, linting, and so on)

It uses a Rollup bundler under the hood to perform chunk bundling and packaging of JavaScript projects.

Starting from Vue 3, Vite has replaced Vue CLI and become the default build tool for managing your Vue applications. Vite also supports TypeScript and provides a leaner developer experience when working on current web projects.

To initialize a new Vue project with Vite, you can use the following specific command:

npm init vue@latest

In this case, you will need to provide additional configurations for Vite to proceed, as shown in Figure 3.1:

Figure 3.1 – Configuration prompt for a new Vue project

Figure 3.1 – Configuration prompt for a new Vue project...

Using Vue Devtools

Vue Devtools is a browser extension for Chrome and Firefox and an Electron desktop app. You can install and run it from your browser to debug your Vue.js projects during development. This extension does not work in production or remotely run projects. You can download the Vue Devtools extension from the Chrome extension page, as seen in the following screenshot:

Figure 3.8 – Vue.js Devtools Chrome extension page

Figure 3.8 – Vue.js Devtools Chrome extension page

You can also download the Vue Devtools extension from Firefox (https://addons.mozilla.org/en-US/firefox/addon/vue-js-Devtools/):

Figure 3.9 – Vue.js Devtools Firefox extension page

Figure 3.9 – Vue.js Devtools Firefox extension page

The Devtools extension reveals useful information within the browser’s developer, including performance and event tracking for any Vue component in your application during running. Once enabled, the extension will add a Vue tab to the developer’s console. The Vue tab displays a view with several...

Summary

In this chapter, you learned about Vite and how to create a Vue project managed by Vite through the command-line Terminal. You also learned about Vue Devtools and how to use its features, which will assist you on this book’s journey to more advanced topics.

The next chapter focuses more on advanced Vue component features, such as passing data from one component to its nested components, validating data received from outside of the element, customizing the layout of a component with slots, and keeping the references of components for external control.

lock icon
The rest of the chapter is locked
You have been reading a chapter from
Frontend Development Projects with Vue.js 3 - Second Edition
Published in: Mar 2023Publisher: PacktISBN-13: 9781803234991
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
undefined
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €14.99/month. Cancel anytime

Authors (4)

author image
Maya Shavin

Maya is Senior Software Engineer in Microsoft, working extensively with JavaScript and frontend frameworks and based in Israel. She holds a B.Sc in Computer Sciences, B.A in Business Management, and an International MBA from University of Bar-Ilan, Israel. She has worked with JavaScript and latest frontend frameworks such as React, Vue.js, etc to create scalable and performant front-end solutions at companies such as Cooladata and Cloudinary, and currently Microsoft. She founded and is currently the organizer of the VueJS Israel Meetup Community, helping to create a strong playground for Vue.js lovers and like-minded developers. Maya is also a published author, international speaker and an open-source library maintainer of frontend and web projects.
Read more about Maya Shavin

author image
Raymond Camden

Raymond Camden is a developer advocate for IBM. His work focuses on the MobileFirst platform, Bluemix, hybrid mobile development, Node.js, HTML5, and web standards in general. He is a published author and presents at conferences and user groups on a variety of topics. Raymond can be reached at his blog, on Twitter, or via email. He is the author of many development books, including Apache Cordova in Action and Client-Side Data Storage.
Read more about Raymond Camden

author image
Clifford Gurney

Clifford Gurney is a solution-focused and results-oriented technical lead at a series-A funded startup. A background in communication design and broad exposure to leading digital transformation initiatives enriches his delivery of conceptually designed front-end solutions using Vue JS. Cliff has presented at the Vue JS Melbourne meetups and collaborates with other like-minded individuals to deliver best in class digital experience platforms.
Read more about Clifford Gurney

author image
Hugo Di Francesco

Hugo Di Francesco is a software engineer who has worked extensively with JavaScript. He holds a MEng degree in mathematical computation from University College London (UCL). He has used JavaScript across the stack to create scalable and performant platforms at companies such as Canon and Elsevier and in industries such as print on demand and mindfulness. He is currently tackling problems in the travel industry at Eurostar with Node.js, TypeScript, React, and Kubernetes while running the eponymous Code with Hugo website. Outside of work, he is an international fencer, in the pursuit of which he trains and competes across the globe.
Read more about Hugo Di Francesco