-
-
Notifications
You must be signed in to change notification settings - Fork 9
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
.jsx
imports do not resolve to .tsx
files
#12
Comments
I feel like that's a bug/incompatibility with VSCode, TypeScript and the MDX extension. They should not change your imports if the files on disk are matching the import module specifier. |
Yeah it seemed like it to me too, which is why I filed the TypeScript / VS Code bug - but it's their opinion that it is working as intended. Regardless of whether it's right or not, if Vite/webpack/tsx/etc supports it, maybe ReMDX can too? Or are there complications in adding this support? |
I don't know exactly what you are running into tbh, this is not the case in my setup and I'm always using fully qualified filenames. Any tool changing the extension to something that does not reflect the filesystem makes resolution slower and is just completely wrong. All that ReMDX does is transform Markdown into TypeScript/JS, which will then be processed through the regular JS build pipeline in Vite together with all your plugins. It does not touch imports at all, which you can verify in this test: https://github.com/nkzw-tech/remdx/blob/main/packages/vite-plugin-remdx/__tests__/plugin.test.ts#L35 Unless there is something I'm missing, this is both a tooling/IDE or bundler/Vite concern, and not something related to ReMDX. I'm happy to reopen and consider a PR if it does indeed turn out to be something that ReMDX can help with. |
When creating a new file by duplicating the default
slides.re.mdx
, VS Code + the MDX extension changed my imports from.tsx
to.jsx
automatically:The actual file on disk is
./sights.tsx
This caused ReMDX / Vite to crash, unable to find the source
.tsx
files:This is normal behavior of TypeScript, to resolve
.ts
or.tsx
files from fully-specified.js
and.jsx
imports:.tsx
files use extension.jsx
, leading to Next.js module resolution error microsoft/TypeScript#55502It seems that Vite itself does support this
.jsx
->.tsx
resolution behavior:But maybe somehow in ReMDX that support is being disabled? (eg. maybe because the import is in an MDX file?)
The text was updated successfully, but these errors were encountered: