Typescript compiling is more strict on Netlify than locally

this is a weird one…

When building/deploying via Netlify, typescript compilation produces more errors than I see locally. They’re legitimate ts errors, but tsc succeeds locally and my dev server (reactjs) runs.

I’ve added some debugging lines, such as: show the typescript version, verify working directory, cat tsconfig file contents
I run the exact same yarn script locally.
I tried switching NODE_ENV back and forth between"production" and “development”.
I tried the “netlify dev” local pipeline.
The true Netlify build pipeline produces more errors

We do use lerna, and build multiple packages, so it’s not a simple situation to reproduce.

any ideas?
–thanks

Hi, have you verified that you’re using the same version of typescript locally as you are in our build environment? We don’t have Typescript in our build environment by default so it’s installed along with the rest of your dependencies using the versions in your package.json. It also will just use your tsconfig file so there isn’t anything we do specially that would make it more “strict”.

yes, all exactly the same. I was hoping you could shed some light on any environment details. Any chance you could share your setup scripts? maybe a docker file if you use that?

thanks

Not just a chance, already open source :slight_smile:

Start here for instructions on using our docker container:

1 Like

I’m also experiencing a similar issue. I recently updated typescript to 3.7.2 and running yarn build locally is working, but I’m getting Typescript error when trying to deploy

Hi, @afreix, and welcome to our Netlify community site.

Arte you using the same version of node during the Netlify build as you are locally? If so, would you please send us the URL for a failing deploy?

If the node versions are not the same, you can set the version in our build by using an environment variable.

If this doesn’t solve the issue, please let us know.