-
Notifications
You must be signed in to change notification settings - Fork 23
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
Fix proxy not working with typescript #212
Fix proxy not working with typescript #212
Conversation
"setupProxy" relies on CRA auto-magic, but the magic will only work if it has the ".js" extension. And then I also changed something in the tsconfig that seems unrelated to me and now it works...?
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.
Can confirm that this fixes the issue! Though I am uncertain whether the changes in tsconfig
are really necessary. Well they also don't seem to break anything so maybe just keep them 🤷
app/tsconfig.json
Outdated
@@ -1,4 +1,8 @@ | |||
{ | |||
"exclude": [ | |||
"node_modules", | |||
"dist" |
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 think you can remove the dist
line, if I'm not mistaken. At least I don't see any folder with that name, and it seems to work without.
Actually, things still work when I comment out the whole exclude
array, can you confirm that? If so, I guess you can remove that as well.
@@ -40,7 +44,7 @@ | |||
|
|||
/* JavaScript Support */ | |||
"allowJs": false, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */ | |||
// "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */ | |||
"checkJs": false, /* Enable error reporting in type-checked JavaScript files. */ |
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.
Commenting this out again also doesn't seem to make any difference. I mean I guess that makes sense since that should theoretically be equivalent to setting this to false
.
I don't think you made these changes without reason though, so maybe I'm doing something wrong while testing this.
Seems the changes to the tsconfig were indeed unnecessary? Weird, could've sworn the exclude was important. But hey, the simpler our config the better. |
app/tsconfig.json
Outdated
@@ -44,7 +40,7 @@ | |||
|
|||
/* JavaScript Support */ | |||
"allowJs": false, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */ | |||
"checkJs": false, /* Enable error reporting in type-checked JavaScript files. */ | |||
"checkJs": true, /* Enable error reporting in type-checked JavaScript files. */ |
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.
Err wait, I believe you just need to comment this line out. Setting it to true
gives me an error in the tsconfig
file because allowJs
also needs to be enabled for this. But also, I'm a little confused by this. JS is not allowed (line 42) but setupProxy.js
is cleary a JS file. Or does that not count as "part of the program"? 🤨
Ok hold on, I've just tested this with the redux-toolkit branch I also "reviewed" the other day, and it seems like the I think I would suggest to either drop your latest revert-commit here, or make the corresponding |
Apparently it does not help with fixing the issue with the setup proxy, so we might as well simplify the config a little.
55c43ac
to
313bf44
Compare
"setupProxy" relies on CRA auto-magic, but the magic will only work if it has the ".js" extension. And then I also changed something in the tsconfig that seems unrelated to me and now it works...?
Fixes #210 .