# How to import and export modules in Typescript Runtime

**URL:** <https://forum.heroiclabs.com/t/how-to-import-and-export-modules-in-typescript-runtime/6121>\
**Category:** Runtime Framework\
**Tags:** getting-started, server-framework, typescript\
**Created:** [March 26, 2025, 9:17am UTC](https://forum.heroiclabs.com/t/how-to-import-and-export-modules-in-typescript-runtime/6121 "2025-03-26T09:17:36Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sakhile\_Mamba](https://avatars.discourse-cdn.com/v4/letter/s/9de0a6/32.png) [@Sakhile\_Mamba](https://forum.heroiclabs.com/u/Sakhile_Mamba)\
**Post date:** [March 26, 2025, 9:17am UTC](https://forum.heroiclabs.com/t/how-to-import-and-export-modules-in-typescript-runtime/6121/1 "2025-03-26T09:17:36Z")

</div>

Hello,

I am trying to import a TypeScript module into my main.ts file, but I am having trouble. Setting “module” to “System” or “AMD” in the tsconfig file does not work. Please help.

Below is my tsconfig file code:

```auto
{
  "compilerOptions": {
    "target": "es5",
    "esModuleInterop": true,
    "forceConsistentCasingInFileNames": true,
    "strict": true,
    "skipLibCheck": true,
    "outFile": "./build/index.js",
    "module": "None",
    "typeRoots": [
      "./node_modules"
    ],
    "lib": [
      "dom",
      "es7"
    ],
    "types": [
      "@types/node",
      "nakama-runtime"
    ]
  }
}

```

The errors I get when trying to run the server in docker are listed below:

```auto
nakama-1 | {"level":"info","ts":"2025-03-26T05:01:05.757Z","caller":"server/runtime_javascript.go:634","msg":"Initialising JavaScript runtime provider","path":"/nakama/data/modules","entrypoint":"build/index.js"}
nakama-1 | {"level":"error","ts":"2025-03-26T05:01:05.784Z","caller":"server/runtime_javascript.go:1694","msg":"Failed to eval JavaScript modules.","error":"ReferenceError: define is not defined at index.js:49:7(41)"}
nakama-1 | {"level":"error","ts":"2025-03-26T05:01:05.785Z","caller":"server/runtime.go:659","msg":"Error initialising JavaScript runtime provider","error":"ReferenceError: define is not defined at index.js:49:7(41)"}
nakama-1 | {"level":"fatal","ts":"2025-03-26T05:01:05.785Z","caller":"main.go:166","msg":"Failed initializing runtime modules","error":"ReferenceError: define is not defined at index.js:49:7(41)"}

```

---

<div class="post-metadata">

**Author:** ![sesposito](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/sesposito/32/2594_2.png) [@sesposito](https://forum.heroiclabs.com/u/sesposito)\
**Post date:** [March 26, 2025, 10:57am UTC](https://forum.heroiclabs.com/t/how-to-import-and-export-modules-in-typescript-runtime/6121/2 "2025-03-26T10:57:48Z")

</div>

Please mirror the settings on our [template project](https://github.com/heroiclabs/nakama-project-template).

If you need a more complex build pipeline, there should be a `spe/rollup` branch but it hasn’t been updated in a while so I cannot guarantee it is current.
