I would like to import modules written in typescript for Google Apps Script.
Currently, in my actions/action.ts
I have:
import {Foo} from "../module.ts";`
Unfortunately, when using clasp this compiles to modules_1.Foo
without importing the module, causing a ReferenceError: module_1 is not defined
.
I’ve attempted compiling using tsc
, but it creates requires
statements that Apps Script doesn’t seem to handle either.
Previous answers from 2018 attribute the faulty import to the runtime differences between the V8 environment and Google’s proprietary one, but since then the V8 is now the default Apps Script runtime and I would have expected it to work.
Are import statements not supported within Apps Script?