volarjs / volar.js

💙🌊
https://volarjs.dev/
MIT License
963 stars 47 forks source link

Error: VirtualCode id must be lowercase: scriptSetupFormat #211

Closed linpengteng closed 2 months ago

linpengteng commented 2 months ago

When I run pnpm build:

> vue-tsc --noEmit && vite build

Error: VirtualCode id must be lowercase: scriptSetupFormat
    at verifyVirtualCode (/Users/linpengteng/Library/WorkSpaces/github/vscode/antd-templater/template-3.x/node_modules/.pnpm/@volar+language-core@2.3.2/node_modules/@volar/language-core/index.js:230:19)
    at Object.set (/Users/linpengteng/Library/WorkSpaces/github/vscode/antd-templater/template-3.x/node_modules/.pnpm/@volar+language-core@2.3.2/node_modules/@volar/language-core/index.js:127:29)
    at /Users/linpengteng/Library/WorkSpaces/github/vscode/antd-templater/template-3.x/node_modules/.pnpm/@volar+typescript@2.3.2/node_modules/@volar/typescript/lib/node/proxyCreateProgram.js:76:42
    at Object.get (/Users/linpengteng/Library/WorkSpaces/github/vscode/antd-templater/template-3.x/node_modules/.pnpm/@volar+language-core@2.3.2/node_modules/@volar/language-core/index.js:42:17)
    at /Users/linpengteng/Library/WorkSpaces/github/vscode/antd-templater/template-3.x/node_modules/.pnpm/@volar+typescript@2.3.2/node_modules/@volar/typescript/lib/node/proxyCreateProgram.js:138:157
    at Object.fileExists (/Users/linpengteng/Library/WorkSpaces/github/vscode/antd-templater/template-3.x/node_modules/.pnpm/@volar+typescript@2.3.2/node_modules/@volar/typescript/lib/resolveModuleName.js:24:50)
    at tryFileLookup (/Users/linpengteng/Library/WorkSpaces/github/vscode/antd-templater/template-3.x/node_modules/.pnpm/typescript@5.5.2/node_modules/typescript/lib/tsc.js:39987:20)
    at tryFile (/Users/linpengteng/Library/WorkSpaces/github/vscode/antd-templater/template-3.x/node_modules/.pnpm/typescript@5.5.2/node_modules/typescript/lib/tsc.js:39978:12)
    at tryExtension (/Users/linpengteng/Library/WorkSpaces/github/vscode/antd-templater/template-3.x/node_modules/.pnpm/typescript@5.5.2/node_modules/typescript/lib/tsc.js:39971:18)
    at tryAddingExtensions (/Users/linpengteng/Library/WorkSpaces/github/vscode/antd-templater/template-3.x/node_modules/.pnpm/typescript@5.5.2/node_modules/typescript/lib/tsc.js:39968:107)

When I globally searched for the scriptSetupFormat field, I found that it came from vue-sfc-scripts. js (@vue/language core)

image
linpengteng commented 2 months ago

Can Error information be eliminated

chenli1989 commented 2 months ago

@linpengteng I encountered the same problem. How did you finally solve this issue?

linpengteng commented 2 months ago

@chenli1989 Vuejs fixed the bug, try pnpm install

issuses -> https://github.com/vuejs/language-tools/issues/4497 fix bug -> https://github.com/vuejs/language-tools/pull/4498/files

image
linpengteng commented 2 months ago

@chenli1989

If it still doesn't work, you can refer to the following in package.json

"pnpm": {
    "overrides": {
        "@volar/typescript": "2.3.1",
        "@volar/language-core": "2.3.1"
    }
}