从0开始搭建一个前端项目(vue + vite + typescript)

发布于:2025-08-29 ⋅ 阅读:(9) ⋅ 点赞:(0)
  1. 版本
node:v22.17.1
pnpm:v10.13.1
vue:^3.5.18
vite:^7.0.6
typescipt:~5.8.0
  1. 脚手架初始化vue
pnpm create vue@latest

只选择: TypeScript, JSX
3. 用vscode打开创建的项目,并删除多余的代码
在这里插入图片描述

  1. eslint安装
参考:https://blog.csdn.net/hhhjjjj/article/details/150929338?spm=1011.2124.3001.6209
  1. tsconfig.json修改,删除 tsconfig.app.json和 tsconfig.node.json
{
  "compilerOptions": {
    "target": "esnext",
    "jsx": "preserve",
    "lib": ["esnext", "dom"],
    "experimentalDecorators": true,
    "baseUrl": ".",
    "module": "esnext",
    "moduleResolution": "node",
    "paths": {
      "/@/*": ["src/*"]
    },
    "resolveJsonModule": true,
    "typeRoots": ["./node_modules/@types/", "./types"],
    "types": ["vite/client", "node"],
    "strict": true,
    "noUnusedLocals": true,
    "noUnusedParameters": true,
    "sourceMap": true,
    "allowSyntheticDefaultImports": true,
    "esModuleInterop": true,
    "forceConsistentCasingInFileNames": true,
    "skipLibCheck": true
  },
  "include": [
    "src/**/*.ts",
    "src/**/*.tsx",
    "src/**/*.vue",
    "tests/**/*.ts",
    "src/utils/path.js",
    "types/**/*.d.ts",
    "types/**/*.ts",
    "types/global.d.ts",
    "types/shims-tsx.d.ts",
    "types/shims-vue.d.ts",
    "mock/asyncRoutes.ts"
  ],
  "exclude": ["node_modules", "dist", "**/*.js"]
}

网站公告

今日签到

点亮在社区的每一天
去签到