async-labs / saas

Build your own SaaS business with SaaS boilerplate. Productive stack: React, Material-UI, Next, MobX, WebSockets, Express, Node, Mongoose, MongoDB. Written with TypeScript.
https://saas-app.async-await.com
MIT License
4.06k stars 674 forks source link

tsconfig.json requires "tsBuildInfoFile" setting #185

Closed joelhenryclark123 closed 1 year ago

joelhenryclark123 commented 2 years ago

Sorry if this is poorly written... my first ever issue submission

Found this bug in chapter 1, but it looks like it exists in all chapters. I get an error when running "yarn build" that says the --incremental flag must be accompanied by --tsBuildInfoFile. I solved this by adding "tsBuildInfoFile": ".tsBuildInfo" right below "incremental":true in tsconfig.json

tsconfig.json: { "compileOnSave": false, "compilerOptions": { "target": "esnext", "module": "esnext", "jsx": "preserve", "allowJs": true, "alwaysStrict": true, "moduleResolution": "node", "allowSyntheticDefaultImports": true, "noUnusedLocals": true, "noUnusedParameters": true, "removeComments": true, "preserveConstEnums": true, "sourceMap": true, "skipLibCheck": true, "baseUrl": ".", "typeRoots": [ "./node_modules/@types" ], "lib": [ "dom", "es2017" ], "strict": false, "forceConsistentCasingInFileNames": true, "noEmit": true, "esModuleInterop": true, "resolveJsonModule": true, "isolatedModules": true, "incremental": true, "tsBuildInfoFile": ".tsbuildinfo" }, "include": [ "next-env.d.ts", "./**/*.tsx", "./**/*.ts" ], "exclude": [ "dist", "production-server", ".next", "out", "next.config.js", "node_modules" ] }

package.json: { "name": "1-end-app", "version": "1", "license": "MIT", "scripts": { "dev": "next", "build": "next build && tsc --project tsconfig.server.json", "lint": "eslint . --ext .ts,.tsx" }, "dependencies": { "dotenv": "^8.2.0", "next": "^9.1.2", "react": "^17.0.2", "react-dom": "^17.0.2", "typescript": "^4.7.3" }, "devDependencies": { "@types/node": "^12.12.2", "@types/react": "^18.0.14", "@types/react-dom": "^18.0.5", "@typescript-eslint/eslint-plugin": "^4.2.0", "@typescript-eslint/parser": "^4.2.0", "eslint": "^6.8.0", "eslint-config-prettier": "^7.1.0", "eslint-plugin-prettier": "^3.3.1", "eslint-plugin-react": "^7.21.5", "prettier": "^2.2.1" } }

klyburke commented 2 years ago

@joelhenryclark123 Thanks for reporting and providing a solution. I'll check this once I get a chance and report back.

klyburke commented 2 years ago

Thanks again @joelhenryclark123 . I confirm this issue and that your solution works. I'll review more and make updates to the code and book text.


UPDATE: @joelhenryclark123 thank you again for reporting and providing a solution. What you suggested works, but we decided to resolve this yarn build issue in another way for now.

This issue does not come up once you upgrade to Next v12. We currently upgrade to Next v12 in Chapter 10 of the book, but in our November/December update this year, we plan to start with Next v12 from the beginning of the book.

So for now, I have updated the next.config.js files from Chapter 1 through Chapter 9 to ignore TypeScript errors when executing yarn build. See Next.js documentation: https://nextjs.org/docs/api-reference/next.config.js/ignoring-typescript-errors. Also see changes I made in the commit: https://github.com/async-labs/saas/commit/3a78feab8febe334e2654d29c19cd30823389fe6

Once all Chapters have Next v12, we will not need the typescript: { ignoreBuildErrors: true, }, line anymore.