-
-
Notifications
You must be signed in to change notification settings - Fork 99
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
ts-node ESM support #64
Comments
Hola~! Thank you :) There's no conversation, but an example instead: https://github.com/lukeed/uvu/tree/master/examples/typescript Notice the ... I've not tried it yet, but you can probably leave this as |
Thanks for the quick reply :) Unfortunately setting edit: just started reading this about esm's import semantics, but I'm still not quite sure if I can express it in a way which would be compatible with both module types. |
TBH I'm not sure what the issue for But given your babel mention, I think that (unfortunately) you need |
Unfortunately no combination of Anyway wrt uvu, I was hoping that Happy to look into creating a PR with examples, if you think it'd be worthwhile! |
Hmm... if you can provide me with a reproduction repo I'll be happy to poke around. I would not consider If I can get a repro in front of me I can contribute more to this convo, but right now I don't have much else to offer you 🙈 |
Here is basically what it comes down to: Now when you remove the const useESM = require(path.join(process.cwd(), 'package.json')).type == 'module';
globalThis.UVU_DEFER = 1;
for (let idx = 0; idx < suites.length; idx++) {
const x = suites[idx];
globalThis.UVU_INDEX = idx;
QUEUE.push([x.name]);
// auto-add to queue
if (useESM) {
const m = await import(x.file);
} else {
require(x.file);
}
} and then calling it with some experimental flags Anyway, thanks for thinking this through with me. This all seems to be still somewhat in-flux and experimental. So maybe i should just close this issue for now and we can look into it again once things stabilize? |
Thanks, I'll poke around 👍 You might want to try The rest of it seems very much in flux and out of my control. Have been loosely waiting for these things to settle into a consensus too, but we're in this CommonJS/ESM limbo for a while longer I'm afraid |
Woop, |
Cool :) I think we can close this then. Now that #7 is unblocked, Thanks! |
Hola,
thanks for the amazing(est!) test runner.
I just moved one of my projects to a TS setup which requires me to use ES modules.
ts-node
has some preliminary support for that: TypeStrong/ts-node#1007Unfortunately that doesn't work with the
--require
flag. I'm not quite sure yet what is needed to make it completely work yet. Maybe just work forts-node
to have a runtime solution that doesn't require callingnode --loader ts-node/esm
?Just wanted to start the conversation, as there doesn't seem to be one around this yet.
✌️
The text was updated successfully, but these errors were encountered: