-
-
Notifications
You must be signed in to change notification settings - Fork 601
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
feat(sucrase): resolve .tsx files #448
Conversation
const resolvedFilename = [`${resolved}.ts`, `${resolved}/index.ts`].find((filename) => | ||
fs.existsSync(filename) | ||
); | ||
const resolvedFilename = [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if for .ts
both ${resolved}.ts
and ${resolved}/index.ts
are checked then I believe that similar should be checked for .tsx
, so both ${resolved}.tsx
and ${resolved}/index.tsx
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@flipsasser please take a look at this comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey sorry somehow I missed this - will fix. Thanks for the review!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It now follows the same pattern as ts imports
@Andarist what is the NPM release schedule like, and can I assist in getting this update published? Please let me know if I can help. Thanks! |
* Resolve .tsx files * Load from index-level tsx files (just like TS) Co-authored-by: Flip Sasser <flip@inthebackforty.com>
Rollup Plugin Name:
sucrase
This PR contains:
Are tests included?
Breaking Changes?
Description
The
@rollup/plugin-sucrase
plugin does not resolve.tsx
files. This PR patches that behavior to allow the use of@rollup/plugin-sucrase
in React / TypeScript projects.It includes a test that imports a TSX file and snapshots the JSX output. It works. Which is great!
Here's a different way of saying it:
@rollup/plugin-sucrase
withtransforms: ["typescript", "jsx"]
will correctly import both.ts
and.tsx
files.@rollup/plugin-sucrase
cannot resolve.tsx
files; only.ts
.