# Compiling Actions from multiple source files

**URL:** <https://community.auth0.com/t/compiling-actions-from-multiple-source-files/76224>\
**Category:** Get Help\
**Tags:** typescript\
**Created:** [January 12, 2022, 12:39am UTC](https://community.auth0.com/t/compiling-actions-from-multiple-source-files/76224 "2022-01-12T00:39:45Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![bschreiber](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/bschreiber/32/34341_2.png) [@bschreiber](https://community.auth0.com/u/bschreiber)\
**Post date:** [January 12, 2022, 12:39am UTC](https://community.auth0.com/t/compiling-actions-from-multiple-source-files/76224/1 "2022-01-12T00:39:45Z")

</div>

I’m trying to implement my Actions in Typescript. In order to maximize both clarity and testability, I would like to be able to split the action into multiple files. Unfortunately, the only module modes under which tsc will honor the “outFile” compiler option (System and AMD) yield code that won’t compile when deployed.

Any tips or tricks to achieve this would be welcome!

---

<div class="post-metadata">

**Author:** ![bschreiber](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/bschreiber/32/34341_2.png) [@bschreiber](https://community.auth0.com/u/bschreiber)\
**Post date:** [February 7, 2022, 2:32pm UTC](https://community.auth0.com/t/compiling-actions-from-multiple-source-files/76224/2 "2022-02-07T14:32:26Z")

</div>

The solution I finally landed on was to drive my build using [Rollup](https://rollupjs.org), and invoking tsc via a Rollup plugin:

```auto
import typescript from '@rollup/plugin-typescript';
import eslint from "@rbnlffl/rollup-plugin-eslint";

export default {
    input: [
        "src/action1.ts",
        "src/action2.ts"
    ],
    output: {
        format: "cjs",
        dir: "dist",
    },
    external: ["auth0","immutable"],
    plugins: [
      eslint(),
      typescript({ module: 'es6' })
    ]
}

```

This setup neatly pulls together exactly what’s needed for each action, duplicating imported classes only as needed, and skipping things like test files. I hope this helps someone else!

---

<div class="post-metadata">

**Author:** ![konrad.sopala](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/konrad.sopala/32/13516_2.png) [@konrad.sopala](https://community.auth0.com/u/konrad.sopala)\
**Post date:** [January 8, 2024, 12:50pm UTC](https://community.auth0.com/t/compiling-actions-from-multiple-source-files/76224/3 "2024-01-08T12:50:26Z")

</div>

Hey there!

As this topic is related to Actions and Rules & Hooks are being deprecated soon in favor of Actions, I’m excited to let you know about our next [Ask me Anything session in the Forum on Thursday, January 18 with the Rules, Hooks and Actions team](https://community.auth0.com/t/auth0-community-ask-me-anything-rules-hooks-and-why-actions-matter/124043) on Rules & Hooks and why Actions matter! Submit your questions in the thread above and our esteemed product experts will provide written answers on January 18. Find out more about Rules & Hooks and why Actions matter! Can’t wait to see you there!

[Learn more here!](https://community.auth0.com/t/auth0-community-ask-me-anything-rules-hooks-and-why-actions-matter/124043)

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [January 22, 2024, 12:51pm UTC](https://community.auth0.com/t/compiling-actions-from-multiple-source-files/76224/4 "2024-01-22T12:51:19Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
