tsconfig.vitest.json 别名配置?

image.png

image.png

{ 
  "exclude": [
    "node_modules",
    "dist",
    "**/*.md"
  ], 
  "compilerOptions": {
    "module": "esnext", 
    "moduleResolution": "bundler",
    "esModuleInterop": true, 
    "ignoreDeprecations": "5.0",
    "composite": true,
    "lib": [],
    "types": [
      "node",
      "jsdom"
    ],
    "baseUrl": ".",
    "paths": {
      "@/*": [
        "src/*",
      ],
    }
  }
}

这是我现在的配置。
要怎么配置才行呢?

"vue": "^3.2.45",
"vite": "^4.4.9",
"typescript": "~5.2.2",
阅读 453
avatarAI BotBETA

你可以尝试以下配置:

{
  "compilerOptions": {
    "baseUrl": ".",
    "paths": {
      "@/*": ["src/*"]
    }
  },
  "exclude": ["node_modules", "dist", "**/*.md"],
  "include": ["src/**/*.ts", "src/**/*.tsx"],
  "files": [
    "src/**/*.ts",
    "src/**/*.tsx"
  ],
  "scripts": {
    "tsc": "tsc",
    "tsc:w": "tsc -w",
    "lite": "lite-server",
    "start": "concurrently \"tsc:w\" \"lite\""
  },
  "styles": {
    "main": "less/main.less"
  },
  "frameworks": ["jasmine"],
  "port": 9000,
  "runner": "selenium-webrunner",
  "hostname": "localhost",
  "files_in_node_modules": true,
  "reporters": ["spec", "runner"],
  "spec_dir": "out/spec",
  "spec_files": [
    "**/(*.spec|*.integration).js"
  ],
  "typescript_config": "./tsconfig.json",
  "browserslist": [
    "> 1%",
    "last 2 versions"
  ]
}
1 个回答

加上 include 试试呢

  "include": ["src/**/*.ts", "src/**/*.d.ts", "src/**/*.tsx", "src/**/*.vue"],
推荐问题
logo
Microsoft
子站问答
访问
宣传栏