language-tools icon indicating copy to clipboard operation
language-tools copied to clipboard

Support Bun

Open Jnp95 opened this issue 1 year ago • 11 comments

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)?

Jnp95 avatar Mar 12 '24 12:03 Jnp95

You can roll back Vue - Official version to 1.8.27 image

manshen666 avatar Mar 15 '24 08:03 manshen666

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).

Jnp95 avatar Mar 15 '24 09:03 Jnp95

Does other package manager / runtime, such as npm and node.js, have the same error?

so1ve avatar Mar 15 '24 09:03 so1ve

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.

Jnp95 avatar Mar 15 '24 09:03 Jnp95

I have the same error on node.js

davidabou avatar Mar 19 '24 21:03 davidabou

@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 avatar Mar 20 '24 14:03 Jnp95

@Jnp95

npm run type-check

Doesn't work for me, I don't know why, until now it worked fine (bizarre)

davidabou avatar Mar 20 '24 15:03 davidabou

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

johnsoncodehk avatar Mar 20 '24 23:03 johnsoncodehk

Suggestion from here:

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:

  • require can 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)

Jnp95 avatar Mar 21 '24 11:03 Jnp95

Let's use this one to discuss bun support as a feature request instead of a bug :)

davidmatter avatar Aug 07 '24 07:08 davidmatter