bluwy / create-vite-extra

Extra Vite templates
MIT License
370 stars 55 forks source link

TypeScript error in src/entry-server.tsx #41

Closed borzaka closed 8 months ago

borzaka commented 9 months ago

I'am using the ssr-react-ts template under Windows 10.

entry-server.tsx:

...
import App from './App'
...

TS Error:

TS6307: File
D:/work/vite-extra-project/src/App.tsx
is not listed within the file list of project
D:/work/vite-extra-project/tsconfig.node.json
. Projects must list all files or use an include pattern.

tsconfig.node.json:

{
  "compilerOptions": {
    "composite": true,
    "skipLibCheck": true,
    "module": "ESNext",
    "moduleResolution": "bundler",
    "allowSyntheticDefaultImports": true,
    "jsx": "preserve"
  },
  "include": [
    "vite.config.ts",
    "src/entry-server.tsx",
    "src/vite-env.d.ts"
  ]
}
bluwy commented 8 months ago

Thanks! It seems like a new TypeScript requirement to also require App.tsx in tsconfig.node.json. Adding that fixes it for me.

bluwy commented 8 months ago

Hmm that didn't quite work. It needs to be added to all depended files recursively, so if App.tsx relies on other *.tsx components too, they need to be added to the include list. I think I'll just remove the src/* reference for now until there's a better way around it.

bluwy commented 8 months ago

Fixed in https://github.com/bluwy/create-vite-extra/commit/5aa3f78ecd97f029dfa3d8936f48d5efce1ce621