-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[V2][Vue-JS-Template] The Template Root Requires Exactly One Element | Vetur Ext Can't Find package.json
File
#1791
Comments
Vetur Can't Find Some *.json Files
package.json
File
Is this a Wails bug though? |
@leaanthony Definitely not a |
I'm not sure we should do anything to be honest. Sounds like something that should be configured in Vetur. Maybe open an issue there? |
I don't think its a Wails issue, maybe the documentation could have a few lines about it? Create a file named vetur.config.js in the project's root. // vetur.config.js
/** @type {import('vls').VeturConfig} */
module.exports = {
// **optional** default: `{}`
// override vscode settings
// Notice: It only affects the settings used by Vetur.
settings: {
"vetur.useWorkspaceDependencies": true,
"vetur.experimental.templateInterpolationService": true
},
// **optional** default: `[{ root: './' }]`
// support monorepos
projects: [
{
// **required**
// Where is your project?
// It is relative to `vetur.config.js`.
// root: './packages/repo1',
root: './frontend',
// **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'
]
}
]
} Veture usually have some issues with the TS config as well: Create a file named frontend/tsconfig.js {
"compilerOptions": {
"module": "system",
"noImplicitAny": true,
"removeComments": true,
"preserveConstEnums": true,
"sourceMap": true,
"outFile": "../../built/local/tsc.js",
"allowJs": true
},
"exclude": [
"node_modules",
"**/*.spec.ts"
],
"include": [
"src/**/*",
"wailsjs/**/*.ts"
]
} |
@KiddoV The original error is about not having multiple tags at the top level of your component. If you wrap lines 6 and 7 in a div, the error will go away. I've added in @lyimmi's info here: https://wails.io/docs/next/guides/vscode#vetur-configuration |
Nice! Thanks guys! |
I believed this file should be frontend/tsconfig.json |
Yes you are correct, made a PR for it: #1795 |
I got another error from Seems like Solution? => this |
Is this config needed with |
I am not sure, but if your VScode doesn't yell anything then you are good to go. |
Description
This bug occurs on the
Vue-JS template
. On theVetur
extension for VSCode.You can still run the app, but the warning (error) is disturbing.
Because
Vetur
can't findpackage.json
, it doesn't know if Vue version is above 2.5.To Reproduce
wails init -n myproject -t vue
myproject
folder with VSCodewails dev
App.vue
file<HelloWorld />
throw an error on VSCodeExpected behaviour
No errors on VSCode
Screenshots
Attempted Fixes
I think it is because we open the wails app from the root folder so
Vetur
can' find ourpackage.json
in thefrontend
folder.Here are the possible solutions:
https://vuejs.github.io/vetur/guide/FAQ.html#vetur-can-t-find-package-json-in-xxxx-xxxxxx
https://vuejs.github.io/vetur/guide/FAQ.html#vetur-found-xxx-but-they-aren-t-in-the-project-root
Maybe we need to add file
vetur.config.js
to the root derectory?Please fix this Vue template, thanks!
System Details
Additional context
No response
The text was updated successfully, but these errors were encountered: