Support Rollup input extension .jsx
See original GitHub issueCurrent Behavior
The file src/index.jsx
is not recognized as a Rollup input:
https://github.com/palmerhq/tsdx/blob/943648edb06cd131f2c1751120cd1301804b480b/src/index.ts#L64-L69
Expected behavior
It should be possible to have the file src/index.jsx
as the Rollup input.
Suggested solution(s)
async function jsOrTs(filename: string) {
const extension = (await isFile(resolveApp(filename + '.ts')))
? '.ts'
: (await isFile(resolveApp(filename + '.tsx')))
? '.tsx'
: (await isFile(resolveApp(filename + '.jsx')))
? '.jsx'
: '.js';
return resolveApp(`${filename}${extension}`);
}
Your environment
Software | Version(s) |
---|---|
TSDX | 0.6.1 |
TypeScript | 3.5.1 |
Browser | Chromium |
npm/Yarn | npm |
Operating System | Ubuntu 18.04 |
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:6
Top Results From Across the Web
Trying Rollup for React Applications | by Nathan Sebhastian
This tutorial will show you how to create a React-Rollup starter app from scratch and how Rollup compares against Webpack in terms of ......
Read more >rollup-plugin-jsx - npm
rollup jsx plugin. This is a simple wrapper around jsx-transform. Make sure to go check that out for options. Install it with npm...
Read more >Rollup + React not compiling JSX - Stack Overflow
All documentation/examples I've found using Rollup + React don't use the latest Babel so it might have something to do with Babel.
Read more >rollup.js
A config file is an ES module that exports a default object with the desired options: export default { input: 'src/main.js', output: {...
Read more >How to support subpath imports using React+Rollup+Typescript
In the early stages, packaging our React+Typescript library with Rollup was straight forward — feed Rollup with a single entry point as ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
That’s true, but I was thinking to align tsdx’s features with CRA and CRA with
--typescript
set also resolves .js{x} files.Wanted to update folks on this issue as this was discussed in #443 as well and I’ve made a few related PRs to improve JSX support.
Per #443, TSDX actually already supports JSX, you just need to make sure your
tsconfig.json
hascompilerOptions.allowJs
set totrue
and that yourinclude
picks it up. TSDX does not by default allow JS or JSX but does support them when they are configured.I’m not sure if this is the case or is still the case, but it works in TSDX. That might only be because TSDX runs Babel on top of
rollup-plugin-typescript2
, but I’m not really sureThere were some bugs related to JSX support, but those might not necessarily have caused issues for all JSX users. Related fixes:
@babel/preset-react
) weren’t always properly merged with TSDX defaults