Open patroza opened 1 year ago
In contrast, when using Vite, it works as expected; https://github.com/effect-ts-app/playground/tree/main/starter-traced-vite
Setup
cd starter-traced-vite
pnpm i
Launch
pnpm start
To inspect the compiled output, look at .cache/*
Quokka
pnpm start
Though atm we have some other limitations here when we make code edits; We must save, and we must make another change after that for the previous change to activate. But that's a known limitations because of our vite tsc compiler plugin architecture, and the reason we would like to use the ts-node implementation.
Thanks for the sample repo. We had never seen tsplus
before.
Why does Quokka not respect the custom typescript compiler, which is used fine by ts-node --esm from the console? So far it seems errors occur even before ts-node/typescript parser/compiler is leveraged.
Wallaby uses TypeScript to compile the file that you start Quokka with, while ts-node
is used for any project-level imports. ts-node
is not being used for the main file that you start Quokka on.
Internally we are using the TypeScript compiler API and the ts.transpileModule function (which does not know about custom transforms).
How do I fix this behaviour?
We would need to add support for custom TypeScript compilers to add support for custom transformers.
I will update the title to reflect this as a feature request. Unfortunately we can't commit to a timeline for the request at this point in time; it may be faster to resolve your vite
solution.
@smcenlly thanks for the response! There are others out there like the compiler of deepkit, and ttypescript and ts-patch. So general support for custom compilers as long as they support sourcemaps etc, could be neat.
Will look into the vite plugin, but with running from buffer vs file it's not so easy.
Will look into the vite plugin, but with running from buffer vs file it's not so easy.
We need to do a similar thing for both Wallaby and Quokka vitest
and vite-node
support. You should be able to implement without too much trouble with a resolveId
and load
plugin. Having said that, if you're using Quokka, it should already be automatically reset unless you have some internal caching in your transformer?
Issue description or question
Why does Quokka not respect the custom typescript compiler, which is used fine by
ts-node --esm
from the console? So far it seems errors occur even before ts-node/typescript parser/compiler is leveraged. How do I fix this behaviour?Is this issue related to Quokka not outputting the expected results of your code?: Yes
https://github.com/effect-ts-app/playground/blob/main/starter-traced/src/main.ts
Several globals and extension methods are at play here, which are auto provided through the extended compiler. It is important that ts-node's
transpileOnly
is false.Compiled output (for reference)
Sample repository link
cd starter-traced
pnpm i
pnpm start
(it runsts-node --esm src/main.ts
) Output:\"Error\"
Stack:
~/Projects/effect-ts-app/playground/starter-traced/src/main.ts:9:58 ~/Projects/effect-ts-app/playground/starter-traced/src/main.ts:24:4
Execution:
~/Projects/effect-ts-app/playground/starter-traced/src/main.ts:13:19 ~/Projects/effect-ts-app/playground/starter-traced/src/main.ts:9:58 ~/Projects/effect-ts-app/playground/starter-traced/src/main.ts:12:19 ~/Projects/effect-ts-app/playground/starter-traced/src/main.ts:9:58 ~/Projects/effect-ts-app/playground/starter-traced/src/main.ts:18:21
"
Quokka PRO 'main.ts' (node: v18.12.1, TypeScript: v5.0.0-tsplus.20230113) Tag is not defined at starter-traced/src/main.ts:7