george43g / better-firebase-functions

This repo provides functionality for a better way of organising files, imports and function triggers in Firebase Cloud Functions

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

TypeScrpit not compiling

zanesc opened this issue · comments

Hello, I am trying to use this module you have developed but my TypeScript files are not compiling. Whenever I deploy to firebase it simply uses the .js files that were already compiled from before and nothing gets updated. I added the two lines you instruct to add to my index.ts (those are the only two lines) and I set all of my triggers to be the default. They are the only functions in their respective files (it's a small project with 4 triggers).

I was using Node 10 but I downgraded to Node 8 to see if that helped but it did not. I tried installing your Node 8 branch but I get the following:
Could not install from "github.com:gramstr/better-firebase-functions.git#node8" as it does not contain a package.json file.

EDIT: Okay, I found the issue but I am not sure how to resolve it. Perhaps you can help. I am referencing an external local module which I have created so that I can share some code between multiple projects. I reference the external module in the tsconfig.json of my main project like this:
"references": [ { "path": "../../SharedCode" } ]

I import a method from the shared code in my main project like this:
import { getParams } from '../../../../SharedCode/src';

The shared code has a method which is exported like this:
export const getParams = (nameArray: string[]): { [names: string]: Params } => { // some code here }

The index.ts of SharedCode exports the file with getParams like this:
export * from './shared_code'

How can I modify my approach, if possible, to work with your module?

I don't believe that any of that has anything to do with the module. It sounds like this is an issue with getting your TS to compile into JS that will successfully run.

Try running firebase functions:shell after building your project and see if you're able to successfully run functions. If not, they won't deploy.

I solved this issue but I am not sure exactly what I did, unfortunately. It might have been changing my "main" in my package.json. However, I have a new issue so I will close this and open a new thread.