Detailed explanation of Vite's new experience

Detailed explanation of Vite's new experience

What is Vite? (It’s a new toy on the front end)

Vite is a web development and construction tool that updates code during the development process through native ES module imports to achieve the purpose of rapid updates.

Features

  • Ultra-fast cold server boots
  • Instant module updates
  • True on-demand compilation
  • Smaller packaging size

Get Started

Note for Vue users: Vite currently only works with Vue 3.x. This also means that you cannot use libraries that are not yet compatible with Vue 3.

Install

npm init vite-app <project name> 
cd <project name> 
npm install 
npm run dev
## After executing the above commands, it means that your vue3.0 project has used vite

What is the difference between vite and webpack in terms of experience?

My current feeling about Vite can be summed up in one word: fast.

  • When starting the debugging service for the first time, it is twice as fast as webpack.
  • The packing speed is also more than twice as fast.
  • The size of the packaged file is less than half of the original webpack file.

How does Vite work?

In the author's words, it is to directly request the .vue file and let the browser parse it

The latest version of the browser supports the direct use of import and export keywords, which means that the browser begins to natively support module functions, which is also one of the features used by Vite.

"After saying so much, why not grab a bag and see?"

sure! Here I only modified the HelloWorld.vue file

Modify the packet capture of HelloWorld

Then I modified the App.vue file again (don’t mind the timestamp is different, I just accidentally deleted it and was too lazy to start over)

Second revision

At this point, compared to Webpack's Code Splitting method of implementing on-demand loading, Vite has indeed given me a much faster experience

at last

Although Vite is very cool, the current RC 1 version is only suitable for Vue3.x and cannot use libraries that are incompatible with Vue3. (It is definitely faster than webpack in all aspects)

This is the end of this article about Vite's new experience. For more information about Vite's new experience, please search 123WORDPRESS.COM's previous articles or continue to browse the following related articles. I hope everyone will support 123WORDPRESS.COM in the future!

You may also be interested in:
  • Detailed explanation of Vue3.0 + TypeScript + Vite first experience
  • Pros and Cons of Vite and Vue CLI

<<:  A practical tutorial on building a fully distributed Hadoop environment under Ubuntu 16.4

>>:  Implementation of MySQL custom list sorting by specified field

Recommend

How to draw a mind map in a mini program

Table of contents What is a mind map? How to draw...

Detailed tutorial on running selenium+chromedriver on the server

1. Introduction I want to use selenium to scrape ...

Recommended plugins and usage examples for vue unit testing

Table of contents frame First-class error reporti...

Common shell script commands and related knowledge under Linux

Table of contents 1. Some points to remember 1. V...

MySql5.7.21 installation points record notes

The downloaded version is the Zip decompression v...

Linux firewall status check method example

How to check the status of Linux firewall 1. Basi...

Implementation of master-slave replication in docker compose deployment

Table of contents Configuration parsing Service C...

How to change mysql password under Centos

1. Modify MySQL login settings: # vim /etc/my.cnf...

Docker image creation Dockerfile and commit operations

Build the image There are two main ways to build ...

Detailed deployment of docker+gitlab+gitlab-runner

environment Server: centos7 Client: window Deploy...

How to use the Linux more command in Linux common commands

more is one of our most commonly used tools. The ...

Docker installation and deployment example on Linux

After reading the following article, you can depl...

How to reference jQuery in a web page

It can be referenced through CDN (Content Delivery...