-
Notifications
You must be signed in to change notification settings - Fork 27.6k
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
Allow custom extensions (.ts .tsx .jsx) #2391
Comments
@berzniz I'm going to look into this RN 👍 |
I also started working on this (with unit and integration tests), but hit a wall where I can not import
but can do it with
Here's what I have so far: |
Cool thanks @berzniz ❤️ |
@berzniz Don't forget to change server/utils.js for hot-loader support |
@berzniz I think what allowed me to do the imports without extensions is that I'm emitting all the files as |
That's great! Totally helps solve the problem |
@berzniz adding |
I see. I'm just providing what I got so far, so someone can mix it with a configurable array of extensions. I'm probably not the person to tackle that (at least not for my first PR) |
@berzniz thanks for the PR. We have a lot of great stuff in 3.0 and we wanna ship it ASAP. |
@timneutkens Initially I was thinking of moving the glob matches and the other configs to the default config so they can be overwritten with a custom |
Hey everyone — what is the velocity on this? I would love to use next.js on an open source project together with (typestyle)[http://typestyle.io/] to generate static, github pages hostable content. This seems to be a nice combination given the static export option and typestyles ability to hoist all css classes. (just an example: egghead > "Generate static css + html files using TypeStyle") |
Congrats to the new release! |
Why so long(( |
Could you guys please merge #2699 to close this ? Thanks... |
Hey @arunoda @timneutkens @nkzawa @rauchg , a friendly reminder that there is on open PR (#2699) to close this "help wanted" labeled ticket. Though it is labeled also as "nice to have", not being able to use TypeScript prevents my company and two other open source projects to switch over to next.js. It may be that you guys are not in a particular need for TypeScript, but searching this repository for typescript revels 31 related tickets alone. Excluding any jsx and extension tickets. Me, including a broad band of the developer community, right up refuses to implement un-typed code. Especially if it is run universally on two or more infrastructures (server, browser, ios, android etc). So I urge you guys to promote this ticket up in your priority chain and take a look at the sitting contribution. A few people have offered help already. Leveling off ecmascript variants (jsx, tsx, cl, etc.) is simply not a gimic. After that, next.js will defiantly become a go-to SSR solution. Thank you for the great work you have put into this project. I am excited what comes next to next.js — all that beyond this corner issue. Best |
@D1no I'm going to have a look at it soon. There's 42 open PRs RN and I have to review most of them. This one is not a small change I can merge in instantly, I'll have to test it thoroughly to make sure nothing breaks 👌 |
Yeah I understand. You guys are getting pupular 🤗 Thank you for jumping in |
@berzniz @gloorx @kylefinley @Rokt33r @mmmeff @stiliankanchev @bangonkali @HyunSeob @lambrojos @stushurik @Fowowski Contributions are very welcome ! |
Any update? |
How about |
I'm trying to switch material-ui over incrementally to Typescript mui/material-ui#9535 and this is a blocker because material-ui uses next.js for docs. I have material-ui (combination of js and ts/tsx files during transition) building with babel 7.x (and webpack) and I do not need to use module: {
loaders: [
{
test: /\.(j|t)sx?$/,
loader: 'babel-loader',
exclude: /(node_modules)/,
query: {
cacheDirectory: true,
},
},
],
},
resolve: {
extensions: ['.ts', '.tsx', '.js'],
}, I'm new here so please be gentle. What rationale prevents next.js from doing the same and simply using If I submit a PR will this one be accepted? |
@rosskevin Please go ahead, I'm also facing this problem when trying to integrate typescript preset to babel |
@rosskevin I really love material-ui. Would you maybe like to check out react-static (https://github.com/nozzle/react-static)? I wanted to do a material-ui example for a while - I also love TypeScript - so there would be e few things falling together, as I would love to see material-ui migrate to ts. React static has a few advantages
https://github.com/nozzle/react-static/tree/master/examples/typescript
Join the react static slack channel or see the history; we are very active. |
This looks like it would be perfect for adding TypeScript support! My team is starting out on a new project and have heard great things about next.js for universal applications. I'm slightly surprised that the TypeScript support isn't there especially with several PR's which seem to solve the issues. I haven't had much time to look through the next.js codebase, but from the PR's I've seen the code changes don't seem overly impactful. Perhaps I'm wrong. Is it worthwhile adopting next.js or should we assume that TypeScript is not in the roadmap and decide between creating our own SSR for React apps or looking elsewhere? |
@ifiokjr May I ask why you‘re waiting for next to move instead of using react-static or any of the other TypeScript supported static site generators? |
@D1no, not all features of next.js accessible in react-static. I have tried to do this, but I need P.S. |
Well, its plain apollo. You would need to use its optimistic ui feature or its hydration feature. But since it’s GraphQL, I‘d suggest you try gatsby instead. Its build around GraphQL: https://github.com/gatsbyjs/gatsby react-static is really about the native react way. So there is not much magic by intention - and inside of the static.config.js you can make all the calls and setup for the static site as you please. However, it requires you to use your libraries features. |
@D1no Please stop promoting/supporting react-static in a next.js issue. Thank you for letting us know the alternative, now I'd like to remain subscribed to the subject at hand - next.js and typescript. |
Sorry @rosskevin, but you follow the wrong rail. react-static is a result or artifact of this issue not moving forward. And as this is Open Source, and react-static an intended solution for server side rendered TypeScript based React projects, filling this gab within the next.js toolset is more than appropriate to point out. Therefore, if you look at my constant involvement in this and other issues related to TS in next, that — what you call promotion — is a pin point answer to the question/problem at hand. If you happen to run blind reading about implementation and solution paths, unfollow this thread and create a new one that deals with implementing a parity to something we have put a lot of work in. Both in issues and neglected PRs to next and react-static as a singelton implementation (not excluding other static site generators). If aunda et. al. have time and interest to mirror behavior, we‘re all happy to help (seen often above). But for the time beeing, out of scope and implemented else where |
I'm going to lock the conversation since I'm working on a solution and the scope of the issues is not being discussed anymore. |
Pretty interesting proposal here: https://github.com/zeit/next.js/pull/2250/files#diff-0f2f34c098f5954f99483c9bd61e439dR51. We could reutilize this as a custom key in
next.config.js
to allow any file extension. Which also resolves the.jsx
extension support 👍talked about it with @arunoda 👌
The text was updated successfully, but these errors were encountered: