# Apolo graphql server v4 setup using Typescript Not working with module exports

**URL:** <https://community.apollographql.com/t/apolo-graphql-server-v4-setup-using-typescript-not-working-with-module-exports/6024>\
**Category:** Server\
**Tags:** server\
**Created:** [March 28, 2023, 8:22am UTC](https://community.apollographql.com/t/apolo-graphql-server-v4-setup-using-typescript-not-working-with-module-exports/6024 "2023-03-28T08:22:24Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![4521\_salleh\_shah](https://sea1.discourse-cdn.com/flex019/user_avatar/community.apollographql.com/4521_salleh_shah/32/4112_2.png) [@4521\_salleh\_shah](https://community.apollographql.com/u/4521_salleh_shah)\
**Post date:** [March 28, 2023, 8:22am UTC](https://community.apollographql.com/t/apolo-graphql-server-v4-setup-using-typescript-not-working-with-module-exports/6024/1 "2023-03-28T08:22:24Z")

</div>

Hi , i recently trying to graphql apolo v4 with typescript , i followed the instructions provided on the website.  
My resolvers and typeDefs were in seperate files , i am importing them as  
import {resolvers} from ‘./resolvers’  
i am using typescript , but it gies error that ,  
“dist/resolvers” are not define. is there any sollution for this .

---

<div class="post-metadata">

**Author:** ![trevor.scheer](https://sea1.discourse-cdn.com/flex019/user_avatar/community.apollographql.com/trevor.scheer/32/5669_2.png) [@trevor.scheer](https://community.apollographql.com/u/trevor.scheer)\
**Post date:** [March 28, 2023, 3:26pm UTC](https://community.apollographql.com/t/apolo-graphql-server-v4-setup-using-typescript-not-working-with-module-exports/6024/2 "2023-03-28T15:26:59Z")

</div>

Can you share a reproduction or the repository where you’re running into this error?

If you’re using ES Modules in TypeScript your file paths probably need to include a `.js` extension, so your import would be from `./resolvers.js` - the js is not a typo. You can see we do this in the Apollo Server repo as well as an example.

---

<div class="post-metadata">

**Author:** ![4521\_salleh\_shah](https://sea1.discourse-cdn.com/flex019/user_avatar/community.apollographql.com/4521_salleh_shah/32/4112_2.png) [@4521\_salleh\_shah](https://community.apollographql.com/u/4521_salleh_shah)\
**Post date:** [April 1, 2023, 11:31pm UTC](https://community.apollographql.com/t/apolo-graphql-server-v4-setup-using-typescript-not-working-with-module-exports/6024/3 "2023-04-01T23:31:08Z")

</div>

Thanks for response:  
github repo: [GitHub - syedslegend786/chat-app-graphql-backend](https://github.com/syedslegend786/chat-app-graphql-backend)

i am important folder imports (“/graphql”===“/graphql/index.ts”) in my root file , but it does’nt convert into graphq/index.js in the dist folder,  
like we do in react js imports.

---

<div class="post-metadata">

**Author:** ![4521\_salleh\_shah](https://sea1.discourse-cdn.com/flex019/user_avatar/community.apollographql.com/4521_salleh_shah/32/4112_2.png) [@4521\_salleh\_shah](https://community.apollographql.com/u/4521_salleh_shah)\
**Post date:** [April 1, 2023, 11:42pm UTC](https://community.apollographql.com/t/apolo-graphql-server-v4-setup-using-typescript-not-working-with-module-exports/6024/4 "2023-04-01T23:42:21Z")

</div>

one more thing ,  
how to setup that , whenever i change my file , then these changes also applied to my app.

---

<div class="post-metadata">

**Author:** ![trevor.scheer](https://sea1.discourse-cdn.com/flex019/user_avatar/community.apollographql.com/trevor.scheer/32/5669_2.png) [@trevor.scheer](https://community.apollographql.com/u/trevor.scheer)\
**Post date:** [April 3, 2023, 4:19pm UTC](https://community.apollographql.com/t/apolo-graphql-server-v4-setup-using-typescript-not-working-with-module-exports/6024/5 "2023-04-03T16:19:49Z")

</div>

Thanks for sharing the repo. If you convert all of your file imports to have the `.js` extension (even the folder / index imports) then the errors go away.

It sounds like you’re interested in a tool like `nodemon`. You’ll want to run TypeScript in watch mode with the `-w` flag, and have `nodemon` watch the `dist/index.js` file for changes.

---

<div class="post-metadata">

**Author:** ![Justin\_Gonzalez](https://sea1.discourse-cdn.com/flex019/user_avatar/community.apollographql.com/justin_gonzalez/32/5359_2.png) [@Justin\_Gonzalez](https://community.apollographql.com/u/Justin_Gonzalez)\
**Post date:** [February 6, 2025, 8:49pm UTC](https://community.apollographql.com/t/apolo-graphql-server-v4-setup-using-typescript-not-working-with-module-exports/6024/6 "2025-02-06T20:49:06Z")

</div>


