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

quokka breaks when tsconfig extends with multiple files #959

Open
bhvngt opened this issue Jul 4, 2024 · 4 comments
Open

quokka breaks when tsconfig extends with multiple files #959

bhvngt opened this issue Jul 4, 2024 · 4 comments

Comments

@bhvngt
Copy link

bhvngt commented Jul 4, 2024

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
Copy link
Member

mburnell commented Jul 4, 2024

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.

@bhvngt
Copy link
Author

bhvngt commented Jul 5, 2024

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
Copy link

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

TypeStrong/ts-node#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
Copy link
Member

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

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

No branches or pull requests

4 participants