React-TypeScript-Webpack-Starter
React-TypeScript-Webpack-Starter copied to clipboard
Issues related to setting up app
Firstly, thanks a lot for your videos and this repo. It's been a very informative and great help. I've completed all the steps till 7 so far and I've got 2 issues. Appreciate any help with this.
- VSCode complaints of this error even though I've copied the config exactly from the repo. - No inputs were found in config file '/src/tsconfig.json'. Specified 'include' paths were '["src/**/*"]' and 'exclude' paths were '[]'.
- My app.tsx complains of "Cannot find module './react.png' or its corresponding type declarations." However, if I just open the declarations.d.ts file and save it, the error goes away. This happens every time I open the application.
Can you publish the project in github and send link? or Mention the project structure.
Please check out the repo at https://github.com/kentmz/react-setup Also, some of the issues I faced was:
- When you navigate to a route and refresh the route, it gives an error saying "Cannot GET /dashboard". I fixed this my adding
output.publicPath = '/' and devServer.historyApiFallback = true
in webpack.
Hi Kent,
-
For the 1st Thread:
- You should always add config files in the root. That's the standared almost all libraries follow.
- declarations file works fine some times. According the editors memory management. It could be trouble some. But you can either restart TextEditor or only the Typescript server. [ ctrl + shift + p , restart typescript server ]. This would restart the lints for default VsCode TS
-
For the recent Thread:
- For routing. I think you should pass the routable component as prop other than child. But If there's way. You should bend your perspective little bit. But I'd recommend for your code. It's fine to pass the dashboard component to the Route Component as a prop.
for referance try these: Sample Router File
Please always pull from "vishwas" repo. Coz, he's constantly updating the setup.
Hi,
Thanks for getting back on this. Appreciate it. I tried to move the tsconfig.json to the root. But now all my imports are giving error, example "Could not find a declaration file for module 'react-router-dom'. " Appreciate your help on this. Thanks.
Yeah you missed some TypeScript packages.
Eg: @types/react-router-dom
, also try comment react-cookies. Since you only declared.
Thanks a lot. This resolved the issue.
Hi Kent,
If the Issue got rectified. Please close.