-
Notifications
You must be signed in to change notification settings - Fork 280
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
Typescript support #427
Typescript support #427
Conversation
@benallfree how do i do that? |
Yeah that's a little difficult because you can't |
@urizennnn you can try this, it's a build from this PR branch
|
can it be installed globally? |
Yes you can try that |
The big problem with this approach and the reason I never merged #397, despite having the ability to is that we need a compiler flag to opt out of the TSX loader so people can use their own to support path flags and other tsconfig options That + docs and tests that we'd need to merge this PR |
Yeah I experimented with integrating more with rechoir but couldn't get the ts test to pass even though Can you say more about opting out of the tsx loader? For now #423 is working for me: "scripts": {
"plop": "cross-env NODE_OPTIONS='--import tsx' plop --plopfile=plopfile.ts",
} If you'd like me to work more on this and get tests passing, I'm happy to keep going. This seems like something Liftoff should have working OOTB, but maybe I don't understand. I thought Liftoff was supposed to install other handlers on demand. This works: const Liftoff = require('liftoff')
const Hacker = new Liftoff({
name: 'hacker',
processTitle: 'hacker',
moduleName: 'hacker',
configName: 'hackerfile',
extensions: {
'.ts': 'tsx/dist/loader.cjs',
},
v8flags: ['--harmony'], // or v8flags: require('v8flags')
})
Hacker.prepare({}, function (env) {
Hacker.execute(env, async (env) => {
await import(env.configPath)
})
}) |
Right, I ran into many of the same problems with Liftoff, myself. I think there was some reason between plop CLI and node-plop that wasn't synced leading to the mismatched behavior. The problems with opting out come from "How do I use one TSconfig for X but another for Plop and both have paths that inherit from a base config" kinda deal. Tbh I REALLY like your NODE_OPTIONS userland fix to this problem, rather than trying to inhouse all of the edgecases. What if we just make a PR to add the explainer on how to do that on our website instead of trying to make it a feature? |
Suits me perfectly, and it also is kind of a forward-looking approach since that Shall I send a docs PR? |
Let's do it! Thanks for your understanding and help! ✨ |
Closing in favor of #428 |
Closes:
#297
#397
#426