Comments (2)
初始化 Vite 项目
直接创建
使用 NPM:
$ npm init vite@latest
使用 Yarn:
$ yarn create vite
使用 PNPM:
$ pnpm create vite
指定项目名称和模板
https://github.com/vitejs/vite/tree/main/packages/create-vite
# npm 6.x
npm init vite@latest my-vue-app --template vue
# npm 7+, 需要额外的双横线:
npm init vite@latest 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
from blog.
vite issues
vite 支持optional Chaining(可选链判断运算符 ?.)和 nullishCoalescingOperator (空值合并运算符 ??)
安装依赖
yarn add @babel/plugin-proposal-optional-chaining --dev
yarn add @babel/plugin-proposal-nullish-coalescing-operator -dev
vite.config.ts
添加配置
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
import checker from "vite-plugin-checker";
import vitePluginImp from "vite-plugin-imp";
import path from "path";
// https://vitejs.dev/config/
export default defineConfig(({ mode }) => {
return {
plugins: [
react({
babel: {
plugins: [
"@babel/plugin-proposal-optional-chaining",
"@babel/plugin-proposal-nullish-coalescing-operator",
],
},
}),
],
};
});
vue 请使用
@vitejs/plugin-vue
[未测试]
from blog.
Related Issues (20)
- React Hooks HOT 4
- Visual Studio Code [VSCode] HOT 1
- React Router v6 HOT 1
- front business logic 前端业务逻辑 HOT 2
- preconstruct HOT 5
- 运维Ops HOT 2
- Turborepo
- Lint HOT 5
- Storybook HOT 3
- esbuild HOT 5
- Commissioning 调试 HOT 1
- express-gateway HOT 1
- Nestjs HOT 1
- 领域驱动设计 Domain-Driven Design DDD HOT 8
- Vue 3 HOT 1
- yarn
- Arduino HOT 17
- C 语言 HOT 3
- IoT 物联网 HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from blog.