当前位置:网站首页>尤雨溪向初学者推荐Vite 【为什么使用Vite】
尤雨溪向初学者推荐Vite 【为什么使用Vite】
2022-07-26 11:51:00 【InfoQ】
问题
服务器启动缓慢
- 依赖关系大多是普通的JavaScript,在开发过程中不经常更改。一些大型依赖项(例如,具有数百个模块的组件库)的处理成本也非常高。依赖项也可以以各种模块格式提供(例如ESM或CommonJS)。
- Vite 使用esbuild[预捆绑依赖项]。esbuild是用Go编写的,预捆绑依赖项比基于JavaScript的捆绑器快10-100倍。
- 源代码通常包含需要转换的非纯JavaScript(例如JSX,CSS或Vue / Svelte组件),并且将经常编辑。此外,并非所有源代码都需要同时加载(例如,使用基于路由的代码拆分)。
- Vite 通过本机 ESM提供源代码。这实质上是让浏览器接管了捆绑器的部分工作:Vite只需要在浏览器请求时按需转换和提供源代码。只有在当前屏幕上实际使用时,才会处理条件动态导入背后的代码。
更新缓慢
304 Not Modified``Cache-Control: max-age=31536000,immutable为什么要捆绑生产
为什么不与esbuild捆绑在一起?
esbuild``esbuildVite与X有何不同?
WMR
@web/开发服务器
es-dev-server@web/dev-server@webSnowpack
安装)的开始
概述
/vit/- 一种开发服务器,它提供比本机 ES 模块[更丰富的功能增强],例如极快的热模块更换 (HMR)。
- 一种生成命令,用于将代码与汇总捆绑在一起,该命令已预先配置为输出用于生产的高度优化的静态资产。
浏览器支持
。元尝试在线体验维特
vite.new/{template}搭建您的第一个 Vite 项目
$ npm create [email protected]
$ yarn create vite
$ pnpm create vite
# npm 6.x
npm create [email protected] my-vue-app --template vue
# npm 7+, extra double-dash is needed:
npm create [email protected] my-vue-app -- --template vue
# yarn
yarn create vite my-vue-app --template vue
# pnpm
pnpm create vite my-vue-app --template vue
vanilla``vanilla-ts``vue``vue-ts``react``react-ts``preact``preact-ts``lit``lit-ts``svelte``svelte-ts社区模板
npx degit user/project my-project
cd my-project
npm install
npm run dev
main``#mainnpx degit user/project#main my-project
index.html
和project root
index.html``public``index.htmlindex.html``<script type="module" src="...">``<script type="module">``<link href>``index.html``%PUBLIC_URL%<root>.html指定备用根目录
vite``vite serve some/sub/dir命令行界面
vite``npx vite{
"scripts": {
"dev": "vite", // start dev server, aliases: `vite dev`, `vite serve`
"build": "vite build", // build for production
"preview": "vite preview" // locally preview production build
}
}
--port``--https``npx vite --help使用未释放的提交
git clone https://github.com/vitejs/vite.git
cd vite
pnpm install
cd packages/vite
pnpm run build
pnpm link --global # you can use your preferred package manager for this step
pnpm link --global vite``vite边栏推荐
- Pytest interface automation test framework | pytest configuration file
- Talking about web vitals
- Audio and video+
- 4.1 configure MySQL and register login module
- 系统调用捕获和分析完结篇制作系统调用日志收集系统
- 远程ip Debugger(实用干货)
- 音视频技术开发周刊 | 255
- Sword finger offer 25. merge two sorted linked lists
- 空洞卷积详解(输入输出大小分析)
- 大佬们,cdc oracle 怎么设置从指定scn号开始读取,或是怎么设置只读全量的归档,不去读取快
猜你喜欢

浅谈低代码技术在物流运输平台中的搭建与管理

The latest heart-shaped puzzle applet source code + with flow master

基于 Flink CDC 实现海量数据的实时同步和转换

Metauniverse gamefi chain game system development NFT Technology

音视频技术开发周刊 | 255
![[early knowledge of activities] list of recent activities of livevideostack](/img/a5/06c13865b7adbd99d43c1a52f3fc4d.png)
[early knowledge of activities] list of recent activities of livevideostack

Hashtable

CVPR 2022 单目深度估计新SOTA—NeW CRFs:Neural Window Fullyconnected CRFs

Harbor2.2 quick check of user role permissions

Why BGP server is used in sunflower remote control? Automatic optimal route and high-speed transmission across operators
随机推荐
DS-112时间继电器
Preliminary test yolov7
大佬们,请教一下,我按照文档配了cdc连接oracle,总是运行报错找不到类 ValidstionE
System call capture and analysis - ring layer kprobe hijacks system calls
Marriage seeking story
SSJ-21B时间继电器
Hou Peixin, chairman of the openharmony Working Committee of the open atom open source foundation, sent a message to the openatom openharmony sub forum
How to use data pipeline to realize test modernization
Pytoch -- error based on mmseg/mmdet training: runtimeerror: expected to have finished reduction in the priority iteration
[download attached] a powerful web automated vulnerability scanning tool - Xray
Win10 uses NVM to install node, NPM, and cnpm
百问百答第48期:极客有约——可观测体系的建设路径
Big view +500 cases, software teams should improve R & D efficiency in this way!
沟通中经常用到的几个库存术语
物联网设备加密的意义
代码实例详解【可重入锁】和【不可重入锁】区别?
征婚故事
pytest接口自动化测试框架 | 通过标记表达式执行用例
pytest接口自动化测试框架 | conftest.py
零基础小白也能懂的 Redis 数据库,手把手教你易学易用!