egoist / rollup-plugin-esbuild

Use ESBuild with Rollup to transform ESNext and TypeScript code.
MIT License
628 stars 40 forks source link

fix: support mapping .js/.jsx extensions to .ts/.tsx #345

Closed JounQin closed 2 years ago

JounQin commented 2 years ago

When using native ESM, extensions like .js or .jsx are required for TypeScript with "moduleResolution": "Node16".

For example: export * from './component.jsx' should try './component.tsx', this PR just drop the file extension and try all possible extensions, if you want behavior more spec compliantly, resolveFile must be refactored a lot AFAIK.

Considering .tsx can also be compiled as .js, I think this PR's behavior is good enough.

cc @egoist

JounQin commented 2 years ago

Friendly pin @egoist

github-actions[bot] commented 2 years ago

:tada: This PR is included in version 4.9.2 :tada:

The release is available on:

Your semantic-release bot :package::rocket: