language-tools
language-tools copied to clipboard
Support Bun
In all bun projects, including this basic template, the command vue-tsc produces this error:
src/main.ts:3:17 - error TS2307: Cannot find module './App.vue' or its corresponding type declarations.
3 import App from './App.vue'
~~~~~~~~~~~
Found 1 error in src/main.ts:3
Whereas it's ok both for linter and static build. Is there a specific missing setup for bun (opposed to Node.js)?
You can roll back Vue - Official version to 1.8.27
You can roll back Vue - Official version to 1.8.27
Actually, VSCode and extensions should not be concerned : I should be able to use vue-tsc command independently (on a pipeline for example, without any EDI).
Does other package manager / runtime, such as npm and node.js, have the same error?
Does other package manager / runtime, such as npm and node.js, have the same error?
No, it doesn't! Which is very surprising! Bun might be identified as the responsible.
I have the same error on node.js
@nethriis
I have the same error on node.js
This example works fine with Node.js / Vue.js / Vite.
Use: npm run type-check to detect my introduced errors in App.vue file.
@Jnp95
npm run type-check
Doesn't work for me, I don't know why, until now it worked fine (bizarre)
vue-tsc cannot work in Bun because it requires modifying the node's fs module, which Bun does not allow.
https://github.com/volarjs/volar.js/blob/0f861d59faa19cbeadef182ee079be88f9629fc7/packages/typescript/lib/quickstart/runTsc.ts#L18
Most likely the linked issue means that overriding readFileSync as a way to hook into module loading. We do not support that currently.
We do support two alternative approaches though:
requirecan be overriden and we have code in place to fully support that- We have pretty good support for Loaders that work for both ESM and CJS (unlike overriding require)
Let's use this one to discuss bun support as a feature request instead of a bug :)