實時更新,
問題1、vetur0.31.0,無法格式化.vue檔案
2020-12-10 已經發布了 0.31.1 版本(Fix Vetur can’t format),安裝新版即可(如果不會安裝插件的固定版本,請看最后),
問題2、Vetur find tsconfig.json/jsconfig.json, but they aren’t in the project root.
0.31.0版本新增了一個vetur.config.js的組態檔,在這個版本之后,會優先查找專案中是否配有tsconfig.json(ts專案)或者jsconfig.json(js專案),沒找到再去找vetur.config.js,如果都沒有,就會拋出這個提示,
方案1、為對應專案(ts/js)添加json檔案
以js專案為例,在根目錄創建jsconfig.json,添加如下代碼,詳情參考檔案
{
"include": [
"./src/*"
]
}
方案2、添加vetur.config.js
普通專案
// vetur.config.js
module.exports = {
// vetur配置,會覆寫vscode中的設定, default: `{}`
settings: {
"vetur.useWorkspaceDependencies": true,
"vetur.experimental.templateInterpolationService": true
},
// 普通專案采用默認配置 default: `[{ root: './' }]`
}
大型專案,可參考檔案
// vetur.config.js
module.exports = {
// vetur配置
settings: {
"vetur.useWorkspaceDependencies": true,
"vetur.experimental.templateInterpolationService": true
},
// support monorepos
projects: [
'./packages/repo2', // shorthand for only root.
{
// **required**
// Where is your project?
// It is relative to `vetur.config.js`.
root: './packages/repo1',
// **optional** default: `'package.json'`
// Where is `package.json` in the project?
// We use it to determine the version of vue.
// It is relative to root property.
package: './package.json',
// **optional**
// Where is TypeScript config file in the project?
// It is relative to root property.
tsconfig: './tsconfig.json',
// **optional** default: `'./.vscode/vetur/snippets'`
// Where is vetur custom snippets folders?
snippetFolder: './.vscode/vetur/snippets',
// **optional** default: `[]`
// Register globally Vue component glob.
// If you set it, you can get completion by that components.
// It is relative to root property.
// Notice: It won't actually do it. You need to use `require.context` or `Vue.component`
globalComponents: [
'./src/components/**/*.vue'
]
}
]
}
方案3、配置vetur插件,忽略提示
在vscode的settings.json里面添加
vetur.ignoreProjectWarning: true
但是檔案中有寫,所以不妨添加個組態檔,也不麻煩,
If you don’t have any tsconfig.json, jsconfig.json in project, Vetur will use fallback settings. Some feature isn’t work. Like: path alias, decorator, import json.
PS:如果你需要,安裝vscode插件歷史版本的方法

找到你需要的版本

轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/232548.html
標籤:其他
上一篇:## Manjaro的一站式安裝流程(以kde版本為例)
下一篇:2.4G、5GWiFi
