当前位置:网站首页>Vite quick start
Vite quick start
2022-06-29 06:46:00 【mun】
know Vite
Vite ( French means " fast ", pronunciation /vit/) It's a new front-end building tool , Can significantly improve the front-end development experience .
It's made up of two parts
A development server , It's based on the original ES The module provides rich built-in functions ,HMR The speed is very fast ; A set of build instructions , It USES rollup Open our code , And it's pre configured , The optimized static resources of the generation environment can be output
install
Vite need Node.js edition >= 12.0.0
$ npm install vite
Start project npx vite
function
Hot module loading
Vite Provides a set of native ESM Of HMR API, Framework utilization API Sure To provide in time 、 Accurate update 、 No need to load the page or clear the file status ,
Pay attention : These are built in Vite in , No need to configure
Yes Css Support for
Vite It can be dealt with directly .css file Also have HMR
Yes css The preprocessor
No specific plug-ins need to be installed , However, you need to install related dependencies
# .scss and .sass
npm install -D sass
# .less
npm install -D less
# .styl and .stylus
npm install -D stylus
Using a single component file requires <style lang="less"> It will turn on automatically
Postcss
vite Direct support for postcss, Direct installation postcss And configuration postcss.config.js File can
// install postcss
npm install postcss-preset-env -d
// To configure postcss
module.exports = {
plugins: [
require("postcss-preset-env")
]
}
st
about .ts It is also natively supported
vue
There are three plug-ins that you can choose to rely on
Vue 3 Single file component support : @vitejs/plugin-vueVue 3 JSX Support : @vitejs/plugin-vue-jsxVue 2 Support : underfin/vite-plugin-vue2
After installation Yes vite.config.js To configure
import vue from "@vitejs/plugin-vue";
module.exports = {
plugins: [
vue()
]
}
vite Run pack
Proceed with the following command
npx vite # Local startup service
# or
npx vite build # Project package
# or
npx vite preview # Preview packaged content locally
configurable pakcage.json Make instruction changes
"scripts": {
"serve": "vite", // Local boot
"build": "vite build", // Project package
"preview": "vite preview" // Package preview
}
view To configure vue/cli Use
This can be done by the following command
npm init @vite/latest
# or
yarn create vite
Later, if you do not install the corresponding dependencies , You will be prompted to install the corresponding dependencies , After the next step, you will be asked to select the frame cli There are options for you to choose
边栏推荐
- Analysis on the wave of learning robot education for children
- Share 10 interview questions related to JS promise
- Go basic data type conversion
- Overlay histogram with density curve
- 'only_ full_ group_ The influence of by'sql mode on group by and its treatment
- String and variable are spliced into variable name
- Antd work item memo w3.0
- Pointer from beginner to advanced (2)
- Some high-level usage of localstorage
- Activiti Designer
猜你喜欢

QT (x): innosetup for software packaging

2022.02.14 - 239. A single element in an ordered array

Hyperledger Fabric 2. X custom smart contract

What is the "danksharding" of V God Kop on Valentine's day?

Difference between URI and URL

MySQL add / delete / modify query SQL statement exercise yyds dry goods inventory

Illustrate plug-in -- AI plug-in development -- creative plug-in -- astute graphics -- multi axis mirroring function

Fault: ntfrs warning log for id13562

Delete tag

配置Flutter开发环境
随机推荐
The echares map is implemented separately by provinces, and the tooltip user-defined prompt box, scattered annotation and scattered illumination are explained in detail
Is there any difference between a=a+b and a+=b?
Li Kou daily question - day 30 -1281 Difference of sum of bit product of integer
解析学习幼儿机器人教育的浪潮
Maximum ascending subarray sum of leetcode simple problem
Internet enterprises need CRM software to help
I would like to ask what securities dealers recommend? Is it safe to open an account online?
Can I cast int to a variable of type byte? What happens if the value is larger than the range of byte type?
The simple problem of leetcode is to divide an array into three parts equal to sum
Fault: display Storport driver out of date in component health
Client and server working modes of JVM
Fault: ntfrs warning log for id13562
The generation of leetcode simple questions each character is an odd number of strings
多线程工具类 CompletableFuture
Antlr4 recognizes the format of escape string containing quotation marks
[Flink] flinksql and table programming cases
Teach you how to develop your own NPM package (publish to the NPM official website)
Draw smooth curves - methods needed - drawing smooth curves - methods needed
Introduction to Ceres Quartet
The annual technology inventory of cloud primitives was released, and it was the right time to ride the wind and waves