Vite2.0 入门

Vite 是下一代前端开发和构建工具

  • 极快速的服务启动
  • 轻量快速的热重载
  • 丰富的功能
  • 优化的构建
  • 通用的插件
  • 完全类型化的 API

构建打包工具 webpack,Rollup和Parcel 的不同
打包器先构建整个应用后提供服务
Vite 通过依赖和源码分开(浏览器支持 ESM 模块)
搭建第一个 Vite 项目 (选中自己喜欢的模板即可)
使用 NPM

npm init @vitejs/app my-app
cd my-app
npm install 
npm run dev

使用Yarn

yarn create @vitejs/app my-app
cd my-app
yarn install
yarn run dev

其他配置在 vite.config.ts 文件中配置
共享配置

  • root
  • base
  • mode
  • resolve

服务器配置

  • host
  • port
  • https
  • cors
  • hmr
  • watch

打包配置

  • target
  • outDir
  • lib
  • minify
  • write

依赖配置

  • entries

SSR 配置

  • external
  • noExternal
原文地址:https://www.cnblogs.com/zhourongcode/p/14629656.html