wasp-lang / wasp

The fastest way to develop full-stack web apps with React & Node.js.
https://wasp-lang.dev
MIT License
13.64k stars 1.18k forks source link

Making type checking of client optional when building for production #1457

Open infomiho opened 1 year ago

infomiho commented 1 year ago

Since we are using Vite, our dev and production process differ a bit in how we handle Typescript.

In development, we don't use tsc to type check the user's code and instead rely on user's IDE to do that. Reasoning can be found here: https://github.com/vitejs/vite/issues/1585

Production build

However, before doing a production build, we run tsc to do some type checking. This is desirable in most scenarios and users don't notice this step unless they have some type errors which they can then fix.

Cases when we want to turn off tsc

In some cases, there are faulty 3rd party libs that only prevent production build due to some failing types. This is annoying and the user should be able to say "I'm okay with that, let me deploy my client".

Proposed solution

We should make it configurable if the type checks are ran when building for production. Something like:

app myApp {
  client: {
    productionBuild: {
      runTypeChecks: false
    }
  }
}

This would enable users to skip the type check if it is blocking their production deployment and reintroduce it at a later date when they can run it without it blocking their deployment.

Martinsos commented 1 year ago

Souns reasonable! Would be even better if they could do it specifically for that package, that they are having trouble with? I guess they could do that by patching it up -> which they can't do with wasp currently, but should be able to do it once we do the restructuring I believe, since they will have access to the package.json!