-
-
Notifications
You must be signed in to change notification settings - Fork 17
try to load typescript for specifier with extensions. #40
base: develop
Are you sure you want to change the base?
Conversation
Hey @mshima, I was trying to use your patch to address a downstream issue: privatenumber/tsx#112. From my quick hacking, you can add support for const mappedExtensions = {
'.js': ['.ts', '.tsx'],
'.cjs': ['.cts'],
'.mjs': ['.mts'],
} as const; Looking forward to seeing your PR merged 😀. |
Right, and as also mentioned in privatenumber/tsx#112, in addition to // Should resolve to a.tsx, a.ts, etc
import a from './a.jsx' |
@jraoult from the issue description, you will need to patch cjs-loader instead, so esbuild-kit/cjs-loader#23 may be relevant but I don't think it fixes the issue. tsx command is the same of You can test using the git branch:
There is already a mapped extension at https://github.com/esbuild-kit/core-utils/blob/a756b7b599cb92ac720c559bee8451f63b1643a1/src/resolve-ts-path.ts#L3-L7. |
b7ccd79
to
c4b4e12
Compare
Just taking this part out of my comment above, to make it visible to anyone here:
|
I also made a Replit with https://replit.com/@karlhorky/esbuild-extension-resolution-js-jsx-cjs-mjs#index.ts |
73f899d
to
0634f90
Compare
@privatenumber would be really nice to have this feature. |
If I understand correctly, following down the line, merging this PR will allow in turn // ComponentA.tsx
export const ComponentA = () => <div />
// ComponentB.tsx
import { ComponentA } from './ComponentA.js'
export const ComponentB = () => <ComponentA /> Right? Either way, how can we move this PR forward? I'm willing to help |
Closes privatenumber/tsx#344.