-
-
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
Unable to set swc option for automatic react runtime #1800
Comments
Is there an equivalence between this swc option and a tsconfig option? In other words, do people using tsc (not swc) use a certain config option to make TSC compile in this way? |
It looks like we should implement a translation between tsconfig's jsx option and the equivalents for swc. https://www.typescriptlang.org/tsconfig#jsx Does that sound correct to you? |
@cspotcode yes! the swc option directly relates tsconfig options and is a blocker to using ts-node to run any tests related to react. In my example, hardhat uses ts-node to compile typescript tests. I would like to replace the transpiler to use swc for performance reasons but cannot since i am unable to transmit this tsconfig option to the swc transpiler. |
What's the mapping between tsconfig options and swc options? Like, when we see certain tsconfig options, which swc options should we generate? If we have this mapping then we can implement the translation. |
jsxIn the jsx option in tsconfig: https://www.typescriptlang.org/tsconfig#jsx
should be mapped to: https://swc.rs/docs/configuration/compilation#jsctransformreactruntime
The jsx import sourcein the jsxImportSource in tsconfig: https://www.typescriptlang.org/tsconfig#jsxImportSource
|
Thanks, if someone has in their tsconfig.json:
...should we be passing a certain value for swc's |
@cspotcode jsxImportSource default value is |
react-jsx and react-jsxdev cause different output from TSC, right? How do we get swc to do the same? |
@cspotcode i read through the swc docs and issues. if I'm not familiar with rust, but seems like thats what the code does. The test for this is that if runtime is set to |
Ok, my concern is this: If a user sets one of their projects to use What is the difference between tsc's react-jsx and react-jsxdev? And how do we send different options to swc to tell it to emit differently, too? |
@cspotcode I understand. I looked it up more. Looks like if it is
looks like that is how it differentiates jsx from jsx dev |
@cspotcode did you need me to do any other clarification or reserach? |
No, I think we're all set. My time is limited so it might be in your best
interest to attempt a pull request yourself. If you choose to do that,
feel free to ping me for guidance.
…On Tue, Jun 21, 2022, 5:13 PM Shravan Sunder ***@***.***> wrote:
@cspotcode <https://github.com/cspotcode> did you need me to do any other
clarification or reserach?
—
Reply to this email directly, view it on GitHub
<#1800 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAC35OBOSPECP5NG7IPOCK3VQIV7VANCNFSM5ZCMOB4Q>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
@cspotcode thank you 🙏🏽 |
This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [ts-node](https://typestrong.org/ts-node) ([source](https://github.com/TypeStrong/ts-node)) | devDependencies | minor | [`10.8.2` -> `10.9.1`](https://renovatebot.com/diffs/npm/ts-node/10.8.2/10.9.1) | --- ### Release Notes <details> <summary>TypeStrong/ts-node</summary> ### [`v10.9.1`](https://github.com/TypeStrong/ts-node/releases/tag/v10.9.1) [Compare Source](TypeStrong/ts-node@v10.9.0...v10.9.1) **Fixed** - Workaround nodejs bug introduced in 18.6.0 ([#​1838](TypeStrong/ts-node#1838)) [@​cspotcode](https://github.com/cspotcode) - Only affects projects on node >=18.6.0 using `--esm` - Older versions of node and projects without `--esm` are unaffected https://github.com/TypeStrong/ts-node/milestone/18?closed=1 ### [`v10.9.0`](https://github.com/TypeStrong/ts-node/releases/tag/v10.9.0) [Compare Source](TypeStrong/ts-node@v10.8.2...v10.9.0) **Added** - `--project` accepts path to a directory containing a `tsconfig.json` ([#​1829](TypeStrong/ts-node#1829), [#​1830](TypeStrong/ts-node#1830)) [@​cspotcode](https://github.com/cspotcode) - previously it required an explicit filename - Added helpful error message when swc version is too old to support our configuration ([#​1802](TypeStrong/ts-node#1802)) [@​cspotcode](https://github.com/cspotcode) - Added `experimentalTsImportSpecifiers` option which allows using voluntary `.ts` file extensions in import specifiers (undocumented except for [API docs](https://typestrong.org/ts-node/api/interfaces/CreateOptions.html#experimentalTsImportSpecifiers)) ([#​1815](TypeStrong/ts-node#1815)) [@​cspotcode](https://github.com/cspotcode) **Fixed** - Fixed bug where `child_process.fork()` would erroneously execute the parent's entrypoint script, not the intended child script ([#​1812](TypeStrong/ts-node#1812), [#​1814](TypeStrong/ts-node#1814)) [@​devversion](https://github.com/devversion) - Fixed support for jsx modes `"react-jsx"` and `"react-jsxdev"` in swc transpiler ([#​1800](TypeStrong/ts-node#1800), [#​1802](TypeStrong/ts-node#1802)) [@​cspotcode](https://github.com/cspotcode) - Fixed support for import assertions in swc transpiler ([#​1817](TypeStrong/ts-node#1817), [#​1802](TypeStrong/ts-node#1802)) [@​cspotcode](https://github.com/cspotcode) - Fixed bug where calling `repl.evalCode()` with code not ending in a newline would not update the typechecker accordingly ([#​1764](TypeStrong/ts-node#1764), [#​1824](TypeStrong/ts-node#1824)) [@​cspotcode](https://github.com/cspotcode) https://github.com/TypeStrong/ts-node/milestone/16?closed=1 </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, click this checkbox. --- This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzMi4xMTEuMSIsInVwZGF0ZWRJblZlciI6IjMyLjExMi4wIn0=--> Co-authored-by: cabr2-bot <cabr2.help@gmail.com> Reviewed-on: https://codeberg.org/Calciumdibromid/CaBr2/pulls/1461 Reviewed-by: Epsilon_02 <epsilon_02@noreply.codeberg.org> Co-authored-by: Calciumdibromid Bot <cabr2_bot@noreply.codeberg.org> Co-committed-by: Calciumdibromid Bot <cabr2_bot@noreply.codeberg.org>
Search Terms
swc options, swc runtime, react automatic
Expected Behavior
There is no way to set swc to use automatic run time in react:
Its not part of the transpiler configs thats passed into swc
Actual Behavior
Steps to reproduce the problem
swc: true
Minimal reproduction
Specifications
The text was updated successfully, but these errors were encountered: