React-TypeScript-Webpack-Starter icon indicating copy to clipboard operation
React-TypeScript-Webpack-Starter copied to clipboard

Issues related to setting up app

Open kentmz opened this issue 3 years ago • 7 comments

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.

  1. 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 '[]'.
  2. 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.

kentmz avatar Apr 01 '21 04:04 kentmz

Can you publish the project in github and send link? or Mention the project structure.

HeyProtagonist avatar Apr 05 '21 08:04 HeyProtagonist

Please check out the repo at https://github.com/kentmz/react-setup Also, some of the issues I faced was:

  1. 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.

kentmz avatar Apr 07 '21 00:04 kentmz

Hi Kent,

  1. 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
  2. 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.

HeyProtagonist avatar Apr 07 '21 04:04 HeyProtagonist

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.

kentmz avatar Apr 07 '21 06:04 kentmz

Yeah you missed some TypeScript packages. Eg: @types/react-router-dom, also try comment react-cookies. Since you only declared.

HeyProtagonist avatar Apr 07 '21 06:04 HeyProtagonist

Thanks a lot. This resolved the issue.

kentmz avatar Apr 08 '21 07:04 kentmz

Hi Kent,

If the Issue got rectified. Please close.

HeyProtagonist avatar Apr 28 '21 05:04 HeyProtagonist