npm create vite@latest
> npx > create-vite ✔ Project name: … vue-ant ✔ Select a framework: › Vue ✔ Select a variant: › TypeScript Scaffolding project in /home/shanjun/workspace/vue-ant... Done. Now run: cd vue-ant npm install npm run dev
安装依赖
yarn
启动
yarn dev
main.ts:17 [Vue warn]: Component provided template option but runtime compilation is not supported in this build of Vue. Configure your bundler to alias "vue" to "vue/dist/vue.esm-bundler.js".
编辑vite.config.ts
vite.config.ts
import { defineConfig } from 'vite' import vue from '@vitejs/plugin-vue' // https://vite.dev/config/ export default defineConfig({ plugins: [vue()], resolve: { alias: { vue: 'vue/dist/vue.esm-bundler.js', // 使用支持模板编译的版本 }, } })