Relative Content

Tag Archive for typescriptfirebasegoogle-cloud-functionses6-modules

Compiling typescript into ECMAScript Modules for google firebase functions

I am developing a react app with a google firebase backend. Additionally, I have some shared logic between the frontend and the backend that I store in a shared library. These are all written in typescript. To ensure consistency between these components, I have them compile to ECMAScript modules. When I do this however, the firebase functions code does not seem to correctly handle imports and file extensions. I have source files for my firebase functions. index.ts and sisAPI.ts. In index.ts I include sisAPI.ts with an import from ./sisAPI. However, when I run the functions emulator, I get the error Cannot find module functions/lib/sisAPI imported from functions/lib/index.js. It seems like the .js extension is dropped on the sisAPI module. Is there a way to fix my module resolution?