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

Support swc ts-node option. #302

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Support swc ts-node option. #302

wants to merge 1 commit into from

Conversation

shahmirn
Copy link

No description provided.

@shahmirn
Copy link
Author

@wclr Could you take a look at this PR? It should be fairly minor.

@KyleAMathews
Copy link

Keen to try this out! We've got a large code base that takes ~30s to startup right now and would love to cut that down.

@frederikvanhevel
Copy link

+1

@matsko
Copy link

matsko commented Apr 8, 2022

Any progress on this?

@cspotcode
Copy link

ts-node can pull all of these options from your tsconfig.json, is there some reason that can't be done when using ts-node-dev?

https://typestrong.org/ts-node/docs/configuration#via-tsconfigjson-recommended

@emaciel10
Copy link

Any updates here? This would also reduce our build times by quite a bit

@rafaell-lycan
Copy link

+1

@hansott
Copy link

hansott commented Aug 15, 2022

If you want an alternative solution, I've switched ts-node-dev to https://github.com/esbuild-kit/tsx, it's great! :)

ts-node-dev was always causing problems (high CPU, compatibility macOS/Linux) and I wanted a tool that combined watching and transpiling (so that I didn't have to install something like nodemon)

Example: npx tsx watch ./file.tsx

(I'm unaffiliated with tsx)

@rubnogueira
Copy link

@wclr Could you take a look at this PR? Basically, we cannot use this tool with ts-node + swc, since it overrides the transpileOnly property.

Copy link

@akwodkiewicz akwodkiewicz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The chosen option alias is not present in the ts-node docs.

@@ -37,6 +38,7 @@ const tsNodeFlags = {

const tsNodeAlias = {
'transpile-only': 'T',
'swc': 'W',

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

from what I can see in the official docs, ts-node does not use -W short flag for swc, there's only a full --swc option

@@ -203,7 +203,8 @@ export const makeCompiler = (
emit: options['emit'],
files: options['files'],
pretty: options['pretty'],
transpileOnly: options['transpile-only'],
transpileOnly: options['transpile-only'] ? true : undefined,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was the original options['transpile-only'] assignment not working properly? Is there an edge case that had to be resolved with a ternary operator?

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

Successfully merging this pull request may close these issues.

10 participants