-
Notifications
You must be signed in to change notification settings - Fork 761
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
add typescript template #963
Conversation
I think the plugin takes care of some more things you have manually defined. Might want to check: https://gitlab.com/Vinnl/react-static-plugin-typescript/blob/master/src/node.api.ts |
ok i can remove from what i can tell that is the only line i can take out tho... unless i simplify the |
That's your call. Anything to make it more reusable.
…On Fri, Jan 11, 2019 at 4:37 PM swyx ***@***.***> wrote:
ok i can remove extensions: ['.js', '.jsx', '.ts', '.tsx']
from what i can tell that is the only line i can take out tho... unless i
simplify the webpack.config.js insertion process
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#963 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AFUmCUR1_WYtXr74LkqV1WRBSnX15vS3ks5vCSBLgaJpZM4Z8Rka>
.
|
alright simplified a buncha stuff |
What else could we do to avoid the API file? |
are they a bad thing? theyre the canonical place to modify webpack config right? |
Yeah but if it's typescript related it could possibly be passed as a plugin
option.
…On Fri, Jan 11, 2019 at 5:34 PM swyx ***@***.***> wrote:
are they a bad thing? theyre the canonical place to modify webpack config
right?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#963 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AFUmCX17JNCGl6qocHKlrGu4HEYVn4Nyks5vCS2AgaJpZM4Z8Rka>
.
|
If you're reasonably convinced this is how far we can push things into the plugin, then let me know and we'll get this merged. |
sorry been busy with the netlify allhands past few days. gonna try a few things and see - my lack of complete knowledge of the RS api (and imperfect knowledge of webpack, its always been a weak point of mine) is probably hindering me here from a totally elegant solution but we can definitely improve this over time. already used it for my podcasting site btw |
ok so i figured I was only using the node.api for path aliases which are frankly optional so i could just take them out. if it were to be a plugin option it would have to be added upstream to anyway - removing them made it a lot simpler, and brings us closer to just doing what the basic template does but in typescript! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for pinging me @sw-yx :)
Aliases are actually issue #1 for the TypeScript plugin - when support lands, it should be automatic (as in: paths you define in your TypeScript config should Just Work). If you think it's important that it's supported then I could work on that this weekend, as it could save you some documentation. If so, let me know.
"@types/react-hot-loader": "^4.1.0", | ||
"@types/webpack-env": "^1.13.6", | ||
"convert-tsconfig-paths-to-webpack-aliases": "^0.9.2", | ||
"ts-loader": "^5.3.3", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you add the plugin, you shouldn't be required to install TypeScript and a loader yourself. (And in any case, the plugin doesn't use ts-loader :) )
"paths": { | ||
"@components/*": ["src/components/*"] | ||
}, | ||
"typeRoots": ["./node_modules/@types"], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think typeRoots
is necessary? For reference, see the tsconfig at https://www.npmjs.com/package/react-static-plugin-typescript#usage
ohhh nice! ok that can work. and thanks for the tips, will update |
It was more involved than I estimated it to be, but on the plus side, I did most of the work tonight. I still have to clean it up for actual release (probably still this weekend), but it'd be great if you could test it using the template before that. You can install it using:
|
wowww. i'm so glad i tagged you lol. trying now. |
@Vinnl it works! waiting for whenever you are ready to update your plugin, then i'll push/merge this template with the final version |
Great! Coincidentally I just finished adding tests and such. It's building now, when that's finished I'll release 3.1.0 with alias support. I'll ping you when that's done :) (Don't forget to update the README btw! :) ) |
@sw-yx It's been released! V3.1.0. |
ok thanks Vinnl you rock. as far as i can tell i'm ready to merge this. pinging @tannerlinsley in case any final comments. |
This is great you guys. Seriously, so good. |
The only thing left is to add it to this page: https://github.com/nozzle/react-static/tree/master/packages/react-static/templates |
ok, updated and added a mention in that README |
Merged! Thanks guys. This is just awesome. |
It should now be available in the latest release 🎉 |
Great, thanks! Unfortunately, I did still run into an error when trying it out:
This is in |
solved in the related issue #980 |
I've tried typescript template, but it failed right away: #989. Update: Upgrading |
TypeScript template does not support image import: I guess it's missing Webpack config? |
Thanks for opening a new issue. It's not good practice to comment on a PR merged over 2 years ago. |
Description
add typescript template. mostly a direct port of the basic template to typescript, but with aliases set up properly.
Motivation and Context
make it easier to use RS with TS
Types of changes
Checklist: