Skip to content
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.0.29-v2.1.2 incompatibility of vite-plugin-checker with vuejs/language-tools #4755

Closed
os-tohe opened this issue Aug 30, 2024 · 19 comments · Fixed by fi3ework/vite-plugin-checker#398
Labels

Comments

@os-tohe
Copy link

os-tohe commented Aug 30, 2024

Vue - Official extension or vue-tsc version

v2.0.29

VSCode version

1.92.2

Vue version

3.4.38

TypeScript version

5.5.4

System Info

System:
    OS: Windows 10 10.0.19045
    CPU: (16) x64 AMD Ryzen 7 PRO 5850U with Radeon Graphics
    Memory: 4.32 GB / 14.83 GB
  Binaries:
    Node: 20.11.0 - C:\Program Files\nodejs\node.EXE
    npm: 10.8.2 - C:\Program Files\nodejs\npm.CMD
    pnpm: 9.7.0 - ~\AppData\Local\pnpm\pnpm.EXE
  Browsers:
    Edge: Chromium (127.0.2651.86)
    Internet Explorer: 11.0.19041.4355

Steps to reproduce

Install version any version between v2.0.29-v2.1.2 and start the Vue 3 vite project.

What is expected?

Vue 3 project should start.

What is actually happening?

Throws this error and fails starting:

node:internal/event_target:1100
  process.nextTick(() => { throw err; });
                           ^
TypeError [Error]: pluginContext.vueCompilerOptions.plugins is not iterable
    at createPlugins (C:\path\node_modules\@vue\language-core\lib\plugins.js:48:45)
    at Object.createVueLanguagePlugin (C:\path\node_modules\@vue\language-core\lib\languagePlugin.js:52:49)
    at exports.getLanguagePlugins (C:\path\node_modules\vite-plugin-checker\dist\esm\checkers\vueTsc\languagePlugins.cjs:30:33)
    at Object.apply (C:\path\node_modules\@volar\typescript\lib\node\proxyCreateProgram.js:50:33)
    at getBuilderCreationParameters (C:\path\node_modules\vite-plugin-checker\dist\esm\checkers\vueTsc\typescript-vue-tsc\lib\typescript.js:128533:18)
    at createSemanticDiagnosticsBuilderProgram (C:\path\node_modules\vite-plugin-checker\dist\esm\checkers\vueTsc\typescript-vue-tsc\lib\typescript.js:129027:74)
    at synchronizeProgram (C:\path\node_modules\vite-plugin-checker\dist\esm\checkers\vueTsc\typescript-vue-tsc\lib\typescript.js:131054:7)
    at Object.createWatchProgram (C:\path\node_modules\vite-plugin-checker\dist\esm\checkers\vueTsc\typescript-vue-tsc\lib\typescript.js:130960:3)
    at Object.configureServer (file:///C:/path/node_modules/vite-plugin-checker/dist/esm/checkers/vueTsc/main.js:103:13)
Emitted 'error' event on Worker instance at:
    at [kOnErrorMessage] (node:internal/worker:326:10)
    at MessagePort.<anonymous> (node:internal/worker:232:57)
    at [nodejs.internal.kHybridDispatch] (node:internal/event_target:826:20)
    at exports.emitMessage (node:internal/per_context/messageport:23:28)

Node.js v20.11.0

Link to minimal reproduction

No response

Any additional comments?

No response

@KazariEX
Copy link
Collaborator

Does the tsconfig.json exist?

@os-tohe
Copy link
Author

os-tohe commented Aug 30, 2024

Yes it looks like this:

{
  "extends": "@vue/tsconfig/tsconfig.dom.json",
  "compilerOptions": {
    "lib": ["ES2021", "DOM", "DOM.Iterable"],
    "paths": {
      "@/*": [
        "./src/*"
      ]
    },
    "types": [
      "node", "vitest/globals"
    ]
  },
  "include": [
    "src/**/*.ts",
    "src/**/*.d.ts",
    "src/**/*.tsx",
    "src/**/*.vue"
  ],
  "references": [
    {
      "path": "./tsconfig.node.json"
    }
  ]
}

And tsconfig.node.json looks like this:

{
  "compilerOptions": {
    "composite": true,
    "module": "esnext",
    "moduleResolution": "node"
  },
  "include": ["vite.config.ts"]
}

@KazariEX
Copy link
Collaborator

KazariEX commented Aug 30, 2024

Try adding this and check again:

{
  "vueCompilerOptions": {
    "plugins": []
  }
}

And it would be best to provide a minimal repro.

@os-tohe
Copy link
Author

os-tohe commented Aug 30, 2024

That does not seem to help, but I noticed a strange thing about this version. If I install the version like this: "vue-tsc": "2.0.29" it does not throw any errors. But if I install it with the ^ prefix like this: "vue-tsc": "^2.0.29" it throws the error. The version 2.1.2 throws the error with or without ^ prefix. I'll provide a minimal repro when I have more time available.

@Paxton0222
Copy link

Paxton0222 commented Aug 30, 2024

I encountered this error when enabling vue-tsc with vite-plugin-checker.

I traced the issue to possibly being caused by this: https://github.com/vuejs/language-tools/blob/v2.1.2/packages/language-core/lib/languagePlugin.ts#L51.

It appears to be an issue caused by incorrect parameter injection.

@davidmatter
Copy link
Collaborator

@ohchi
Copy link

ohchi commented Aug 30, 2024

I have the same issue: [email protected] [email protected] [email protected] [email protected]
Actually pluginContext.vueCompilerOptions.plugins is not iterable because it's undefined.

@davidmatter
Copy link
Collaborator

I've opened a PR with them fi3ework/vite-plugin-checker#395

@davidmatter davidmatter changed the title v2.0.29-v2.1.2 throws TypeError [Error]: pluginContext.vueCompilerOptions.plugins is not iterable v2.0.29-v2.1.2 incompatibility of vite-plugin-checker with vuejs/language-tools Aug 30, 2024
@nielsvh2103
Copy link

nielsvh2103 commented Sep 2, 2024

Same issue here, still happens on 2.1.4 using vite plugin checker 0.7.2, works as long as you pin vue-tsc at 2.0.29 for now

This issue only happens when you are between 2.1.0 - 2.1.4

@andrija-menuapp
Copy link

andrija-menuapp commented Sep 4, 2024

Same issue here

@jiikoosol
Copy link

I have the same issue

@daniluk4000
Copy link
Contributor

Opened another PR to resolve this on checker level

fi3ework/vite-plugin-checker#398

@KazariEX KazariEX closed this as completed Sep 6, 2024
@gaomingzhao666
Copy link

same issue in [email protected]

@nielsvh2103
Copy link

nielsvh2103 commented Sep 6, 2024

same issue in [email protected]

it was merged this morning, if you update to [email protected] with vite-plugin-checker 0.8.0 it should work.
Or if you dont use vite plugin checker, it should also work on latest vue version running on [email protected]

if this doesnt work after updating i suggest opening a new issue

@andrija-menuapp
Copy link

andrija-menuapp commented Sep 6, 2024

Does not work on
"vue": "^3.5.3",
"vue-tsc": "^2.1.6",
"nuxt": "^3.13.1"

@KazariEX
Copy link
Collaborator

KazariEX commented Sep 6, 2024

Please open a new issue if the problem still occurs on your end!

@daniluk4000
Copy link
Contributor

Hey folks. Since plugin checker released this as "major" (in terms of 0.x versioining) version, Nuxt has to update dependency on their side first - and they did that, fix will be available in next patch.

For now, you can pin resolution in any way you like, fix example:

 "resolutions": {
    "vite-plugin-checker": "^0.8.0"
  },

lskellerm added a commit to lskellerm/QRafty that referenced this issue Sep 12, 2024
…sting

Updated dev dependencies:
  - @iconify-json/lucide
  - @iconify-json/material-symbols
  - @nuxt/eslint
  - @vue/devtools-api
  - eslint
  - happy-dom
  - husky
  - tailwindcss
  - typescript
  - vue-tsc

  Also added a dependency override for nuxt peer dependency, 'vite-plugin-checker' for known issue -> vuejs/language-tools#4755 (comment)

Updated Prod deps:
  - vue
@yansiegers
Copy link

Next patch of Nuxt is available: https://github.com/nuxt/nuxt/releases/tag/v3.13.2

@andrija-menuapp
Copy link

Next patch of Nuxt is available: https://github.com/nuxt/nuxt/releases/tag/v3.13.2

Can confirm that the error is fixed for me
Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet