quokka icon indicating copy to clipboard operation
quokka copied to clipboard

quokka breaks when tsconfig extends with multiple files

Open bhvngt opened this issue 1 year ago • 4 comments

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

bhvngt avatar Jul 04 '24 08:07 bhvngt

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.

mburnell avatar Jul 04 '24 23:07 mburnell

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.

bhvngt avatar Jul 05 '24 04:07 bhvngt

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?

smallmain avatar Aug 25 '24 03:08 smallmain

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

smcenlly avatar Aug 26 '24 00:08 smcenlly