当前位置:网站首页>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
边栏推荐
- Design of leetcode simple problem goal parser
- What are the uses of wireless pressure collectors?
- QT (x): packaging and deployment
- Hyperledger Fabric 2. X custom smart contract
- I would like to ask what securities dealers recommend? Is it safe to open an account online?
- Fault: KDC warning log for id29
- Fault: ntfrs warning log for id13562
- 百度小程序自动提交搜索
- Mongodb paging method
- What is the "danksharding" of V God Kop on Valentine's day?
猜你喜欢

Clickhouse data type

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

Share 10 interview questions related to JS promise

Yyds dry goods inventory meituan's two-sided experience, and finally there was a surprise?

How to do the performance pressure test of "Health Code"

Labor skills courses integrated into steam Education

Unity ar shadow shadow

Failure: unable to log in to "taxpayer equity platform"

Hyperledger Fabric 2. X custom smart contract

【OSPF引入直连路由时巧借静态黑洞路由做汇总】
随机推荐
Annual inventory review of Alibaba cloud's observable practices in 2021
Flutter is configured with a domestic image and connected to the real machine
力扣每日一题-第30天-594.最长和谐子序列
Exclusive download. Alibaba cloud native brings 10+ technical experts to bring new possibilities of cloud native and cloud future
Small program large screen adaptation Guide
The annual technology inventory of cloud primitives was released, and it was the right time to ride the wind and waves
2022.02.15 - 240. Lucky number in matrix
2022.02.15
Part 63 - interpreter and compiler adaptation (II)
关于DDNS
Presto-Trial
Monitor employee turnover dynamics. This system makes employees tremble!
Chapter V online logic analyzer signaltap
Is there any difference between a=a+b and a+=b?
flutter配置国内镜像,连接真机
Sourcetree remote red exclamation point
Case of single file component files
SCM engineering experience - time slice
C language pointer to function
Servlet version conflict causes page 404