# Typescript build error for missing modules or types declaration

**URL:** <https://answers.netlify.com/t/typescript-build-error-for-missing-modules-or-types-declaration/23291>\
**Category:** Support\
**Tags:** deployment\
**Created:** [September 25, 2020, 10:03pm UTC](https://answers.netlify.com/t/typescript-build-error-for-missing-modules-or-types-declaration/23291 "2020-09-25T22:03:22Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![delca85](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/delca85/32/16324_2.png) [@delca85](https://answers.netlify.com/u/delca85)\
**Post date:** [September 25, 2020, 10:03pm UTC](https://answers.netlify.com/t/typescript-build-error-for-missing-modules-or-types-declaration/23291/1 "2020-09-25T22:03:22Z")

</div>

Hello!

I am totally new here so please forgive me for my maybe newbie question.  
This is my netlify site name: [https://sharp-feynman-110ca1.netlify.app](https://sharp-feynman-110ca1.netlify.app/).

I would like to deploy a monorepo that performs an Apollo GraphQL for the backend and a create react app for the frontend. The project is configured like this:

```auto
-- root
---- netlify.toml
---- package.json (with common scripts)
---- node_modules
---- client
-------- src
-------- package.json
-------- node_modules
-------- ts.config
---- server
-------- functions
-------- src
-------------- macro-product
-------------------- macroProduct.typedefs.ts
-------------------- index.ts
-------------- types
------------------ types.graphql.generated
-------- package.json
-------- node_modules
-------- ts.config
-------- codegen.yml

```

The `server/codegen.yml` file generates, through [graphql code generator](https://graphql-code-generator.com/) typescript types from `server/src/macroProduct.typedefs.ts` producing `server/src/types/types.graphql.generated`.  
What `server/src/macroProduct.typedefs.ts` contains is this:

```plaintext

const typedefs = gql`
  type MacroProduct {
    id: Int!
    parentPartNo: Int!
    childPartNo: Int!
    quantity: Int!
  }

  extend type Query {
    macroProducts: [MacroProduct!]!
    macroProduct(id: Int!): MacroProduct
  }
`;

export default typedefs;

```

I am running the `build` command inside `netlify.toml` that makes run a `prebuild:server` command to install all the dependencies inside the `server` folder an then launches `tsc` to build the server.  
If I run it locally everything works while when I try to deploy it with Netlify this is the error I receive:

```auto
11:36:48 PM: src/macro-product/index.ts:2:49 - error TS2307: Cannot find module './macroProduct.typeDefs' or its corresponding type declarations.
11:36:48 PM: 2 export { default as macroProductTypeDefs } from './macroProduct.typeDefs';

```

This is my `server/tsconfig.json`:

```auto
    "compilerOptions": {
        "allowJs": true,
        "pretty": true,
        "module": "commonjs",
        "sourceMap": true,
        "target": "es2019",
        "outDir": "./functions/bundle",
        "lib": ["ES6"],
        "resolveJsonModule": true, 
        "types": ["node"],
        "moduleResolution": "node",
        "esModuleInterop": true,
        "strict": true,
        "declaration": true,
        "typeRoots": ["./node_modules/@types", "./types", "./functions/bundle"]
    },
  "include": ["src"],
  "exclude": ["node_modules", "src/**/ __tests__"]
}

```

I am really stuck at this issue. I have tried to move the generated types file in the same directory of the source file (removing the `typeRoots` field in `server/tsconfig.json`) but it did not work.

Could gently someone try to help me?

Thanks a lot!

---

<div class="post-metadata">

**Author:** ![delca85](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/delca85/32/16324_2.png) [@delca85](https://answers.netlify.com/u/delca85)\
**Post date:** [September 30, 2020, 4:18pm UTC](https://answers.netlify.com/t/typescript-build-error-for-missing-modules-or-types-declaration/23291/2 "2020-09-30T16:18:24Z")

</div>

This problem was a case of: [case sensitivity](https://answers.netlify.com/t/support-guide-netlify-app-builds-locally-but-fails-on-deploy-case-sensitivity/10754).

Sorry if someone has wasted his/her time on this.

---

<div class="post-metadata">

**Author:** ![perry](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/perry/32/16_2.png) [@perry](https://answers.netlify.com/u/perry)\
**Post date:** [September 30, 2020, 4:39pm UTC](https://answers.netlify.com/t/typescript-build-error-for-missing-modules-or-types-declaration/23291/3 "2020-09-30T16:39:48Z")

</div>

thanks for sharing the fix! case sensitivity has tripped up many a developer …including me. 😃
