Emulators
R-Iqbal opened this issue · comments
RayyanIqbal commented
Hi,
I am trying to setup Firelink with our existing Firebase project with support for Firebase emulators. We are using yarn 3 workspaces.
package.json
"fireDependencies": {
"@claimsgate/core": "../core"
},
"dependencies": {
"@claimsgate/core": "workspace:*"
}
firelink emulators:start --only "functions"
- Emulator tries to start and the code from
../core
is moved into./packages/core
- The code which is moved into
./packages/core
is not compiled, will Firelink automatically compile this code given it has atsconfig.json
Example function
- I created an example function but an error is thrown when the emulators start.
import { functions, region } from "@/firebase";
import { hello } from "@claimsgate/core";
export const testFunction = functions.region(region).https.onRequest(async (req: any, res: any) => {
hello();
});
Emulator error
! Error: Cannot find module '@claimsgate/core'
Require stack:
- C:\Users\Rayyan\Desktop\Work\Media Advancements\Projects\claimsgate\packages\claimsgate-functions\dist\endpoints\misc\testEndpoint.js
- C:\Users\Rayyan\Desktop\Work\Media Advancements\Projects\claimsgate\packages\claimsgate-functions\dist\endpoints\misc\index.js
- C:\Users\Rayyan\Desktop\Work\Media Advancements\Projects\claimsgate\packages\claimsgate-functions\dist\endpoints\index.js
- C:\Users\Rayyan\Desktop\Work\Media Advancements\Projects\claimsgate\packages\claimsgate-functions\dist\index.js
- C:\Users\Rayyan\AppData\Roaming\npm\node_modules\firebase-tools\lib\emulator\functionsEmulatorRuntime.js
If this is the correct behaviour with Firelink then potentially the issue lies with my tsconfig in my functions folder.
Any ideas / advice would be great.
RayyanIqbal commented
Solved it, I needed a top level index.ts
in my claimsgate/core
Kristiqn Tachev commented
Glad you make it !
If you do need some assistance please let me know.
Barrel export is really common practice to expose library specific logic to outside world.
Cheers!