-
-
Notifications
You must be signed in to change notification settings - Fork 533
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
Use .swcrc with the swc transpiler #1796
Comments
I'd accept a PR that adds this as an option, but I still want the default to be zero-config. In your case, you shouldn't need to specify |
I think the problem is that I'd rather not have a
That sounds reasonable 👍 |
I doubt we'll ever support avoiding a tsconfig file, that's too much
complexity for too few users. Plus it's a confusing recommendation to say
to anyone to avoid a tsconfig file in a TS project. Just like any
preference, it's yours to have if you really want it, but it's more effort
for us to support that use-case.
…On Tue, Jun 14, 2022, 10:44 PM David Clark ***@***.***> wrote:
I think the problem is that I'd rather not have a tsconfig.json file in
addition to an .swcrc file.
I'd accept a PR that adds this as an option, but I still want the default
to be zero-config.
That sounds reasonable 👍
—
Reply to this email directly, view it on GitHub
<#1796 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAC35OBSUI2T3NGSAM4U2XDVPE7SVANCNFSM5YSUNJMQ>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
OK -- yeah, maybe the root problem is that swc tools do not read |
@davidtheclark it looks like your problem will be solved by adopting a tsconfig.json. ts-node will read it and behave accordingly. If you run into a situation where you feel like you need two different tsconfig files, because you already have a tsconfig for some other purpose, and yet you need ts-node or swc to behave differently than what is in your tsconfig, then you may want to know that ts-node allows overriding options within your tsconfig, using a "ts-node" sub-object. In general, everything can be configured in that one file: https://typestrong.org/ts-node/docs/configuration#via-tsconfigjson-recommended This setup is simple enough when done correctly. If you run into any trouble, please either ask on the Typescript Discord or start a discussion thread. I'll go ahead and close this ticket, but we can accept a PR (with proper tests!) that adds swcrc support as an option. So if you decide you want to implement that, feel free to open a new issue to discuss the best approach. |
Desired Behavior
When I use the bundled swc transpiler, I'd like it to read configuration from my
.swcrc
file. Instead, it looks like the plugin creates its own swc config based on ts-node's configuration. This means I need to put my swc configuration in two places, instead just in my.swcrc
file.Is this request related to a problem?
Just configuration duplication.
Alternatives you've considered
Using swc packages directly instead of ts-node's swc transpiler. But ts-node's source maps work in my context (VS Code debugger) and swc's do not (as far as I can tell), so I want to stick with ts-node.
Additional context
ts-node was complaining about
import
statements not being legal. It took me a bit to realize this meant it wasn't reading my.swcrc
file, which specified"module": { "type": "commonjs" } }
. To fix this, I setTS_NODE_COMPILER_OPTIONS='{"module":"commonjs"}'
.The text was updated successfully, but these errors were encountered: