-
Notifications
You must be signed in to change notification settings - Fork 973
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
Make auto-import pages support .tsx files. #1651
Conversation
Because we're using node's resolver, and not TS's, right? Anyway, this is great stuff! Now we don't have to wrap our tsx pages in a .js wrapper just to auto-load them with the router! |
8fd92cf
to
9f92af6
Compare
I think this has something to do with I figured that babel's TS module would have registered those in nodejs. https://nodejs.org/api/modules.html#modules_require_extensions |
9f92af6
to
4bcae14
Compare
2fa25f4
to
07145dd
Compare
@peterp this looks great. Just to check in case there's a simpler way, did you try adding extensions to the Babel preset file? I noticed in my pre-render script that typescript files weren't being loaded until I added the line
As part of the Babel config. |
@dac09 Crazy. I would be very surprised if that's actually something that works. It's something that we've always wanted... because otherwise it has to be specified via the CLI, which is super annoying. I can't seem to find it in the docs and I found a bunch of issues and an un-merged PR. If that does work, awesome, but I think this is a better solution, since I removed the recursion and opted for glob instead. |
require.resolve
did not support.tsx
extensions. So, now we're using glob instead. Fast, not recursive. Nice!TODO:
consts
names are PascalCase.@dac09 Probably helpful for your work on pre-rendering.