Compiling Actions from multiple source files

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!

The solution I finally landed on was to drive my build using Rollup, and invoking tsc via a Rollup plugin:

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!