Typescript with Express connector


I’m trying to use Typescript with the Express connector but I keep getting an error when running npm run edgio:dev

$ npm run edgio:dev

> edgio-test@1.0.0 edgio:dev
> edgio dev

> Starting Edgio in development mode with caching disabled...
> Bundling router...
TypeError [ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension ".ts" for /home/andy/dev/projects/edgio-test/src/server.ts Exiting...

To reproduce I’ve used the following.

npm init --yes && npm pkg set type="module"
mkdir src
touch src/server.ts
npm install express
npx @edgio/cli@latest init --name edgio-test
npm run edgio:dev

I have had valid code in server.ts to create the Express server but removed for this example. Also if I just have it has a js file then it’s fine and I can startup. Or if I transpile outside of the Edgio scripts and change appPath to point to my dist folder it works. My reading of the Express connector documentation is that it should work. What am I missing?

I’ve also checked out edgio-v7-full-featured-performance-example which is a TS project although not with Express and that works fine.

@andy Thanks for providing steps to reproduce. I know our team recently made changes to the Express connector to support TS, but I also reproduced the issue and have opened a ticket for them to investigate.

1 Like