Target version not match, you can specify the target version in

1,407 阅读1分钟

Target version not match, you can specify the target version in vueCompilerOptions.target in tsconfig.json / jsconfig.json. (expected "target": 2.7)

这是因为安装了vue3对应的插件volar之后打开了vue2版本的项目导致的,需要在jsconfig.json里主动指明当前版本。

在项目根路径jsconfig添加以下配置即可

"vueCompilerOptions": {
  "target": 2.7
}

完整json参考

{
  "compilerOptions": {
    "target": "es5",
    "module": "esnext",
    "baseUrl": "./",
    "moduleResolution": "node",
    "paths": {
      "@/*": [
        "src/*"
      ]
    },
    "lib": [
      "esnext",
      "dom",
      "dom.iterable",
      "scripthost"
    ]
  },
  "vueCompilerOptions": {
    "target": 2.7
  }
}