wallabyjs / quokka

Repository for Quokka.js questions and issues
https://quokkajs.com
1.18k stars 31 forks source link

quokka breaks when tsconfig extends with multiple files #959

Open bhvngt opened 4 months ago

bhvngt commented 4 months ago

Issue description or question

Is this issue related to Quokka not outputting the expected results of your code?: Yes

Since 5.0 typescript allows tsconfig to be extended with multiple files.

However, current version of quokka breaks when multiple files are passed in an array inside tsconfig.json

Sample code

index.ts

console.log("Hello World")

tsconfig.a.json

{"files": ["./index.ts"]}

tsconfig.b.json

{"include": ["./src/**/*.ts"]}

tsconfig.json

{"extends": ["./tsconfig.a.json", "./tsconfig.b.json"]}

Sample repository link

If the issue can not be reproduced just using the quokka file above (for example because it requires/imports some files from your project), please create a small repository where the issue can be reproduced.

Quokka.js Console Output

TypeError: value.replace is not a function

Code editor version

IntelliJ IDEA 2024.2 EAP (Ultimate Edition) Build #IU-242.19890.14, built on July 3, 2024 quokka.js (1.0.451)

OS name and version

OSX Sonoma 14.5

mburnell commented 4 months ago

Thanks for reporting this issue. The underlying problem is that ts-node 10.9.2 (the latest official release, and upon which quokka relies) does not support this feature of Typescript. A fix for the issue has been committed to ts-node/main; if you're in a position to run ts-node from git, you can work around this problem by running npm install -D TypeStrong/ts-node#main in your project. Please see https://github.com/TypeStrong/ts-node/issues/2000 for additional details.

We'll update quokka to use a new release of ts-node which includes this fix when it becomes available, but in the meantime we'll see if there's anything we can do to address this issue without requiring the workaround described above.

bhvngt commented 4 months ago

Thanks @mburnell for your explanation and reply. For now I have slightly reorganised my code to avoid this issue. Will look forward to the build where this is fixed.

smallmain commented 3 months ago

Thanks for reporting this issue. The underlying problem is that ts-node 10.9.2 (the latest official release, and upon which quokka relies) does not support this feature of Typescript. A fix for the issue has been committed to ts-node/main; if you're in a position to run ts-node from git, you can work around this problem by running npm install -D TypeStrong/ts-node#main in your project. Please see TypeStrong/ts-node#2000 for additional details.

We'll update quokka to use a new release of ts-node which includes this fix when it becomes available, but in the meantime we'll see if there's anything we can do to address this issue without requiring the workaround described above.

@mburnell

https://github.com/TypeStrong/ts-node/issues/2133

It looks like ts-node is out of maintenance and the problem has been going on for over a year. Is there any other runtime to consider?

smcenlly commented 3 months ago

@smallmain - it will require a little configuration, but you should be able to configure Quokka to use vite with vite-node to use a different TypeScript compiler.

We have plans to add first class support for Quokka to use @swc-node/register and tsx in the next few months.