I've got a submodule named shared
which is located next to the backend
folder (which is the cloud functions folder):
I've added the local dependency shared
in backend/package.json
like so:
"dependencies": {
...
"shared": "file:../shared"
}
I ran npm install
and made sure that node_modules/shared
exists. Although, When I run the following code:
firebase deploy --only functions
I get the following error (by firebase):
Error: Error parsing triggers: Cannot find module 'shared/common'
Try running "npm install" in your functions directory before deploying.
This error is due to this line:
import { currentWeek } from 'shared/common';
If I change the directory to ../../../shared/common
, firebase will compile without any errors.
shared/common/index.ts:
export { currentWeek } from './current-week';
shared/tsconfig.json:
{
"compilerOptions": {
"baseUrl": ".",
"target": "es5",
"module": "commonjs",
"declaration": true,
"strict": true,
"removeComments": true
}
}
backend/tsconfig.json:
{
"compilerOptions": {
"baseUrl": ".",
"declaration": true,
"outDir": "./dist",
"module": "commonjs",
"noImplicitAny": false,
"removeComments": true,
"noLib": false,
"allowSyntheticDefaultImports": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"resolveJsonModule": true,
"target": "es6",
"moduleResolution": "node",
"typeRoots": [
"node_modules/@types"
],
"lib": [
"es2015",
"dom"
]
},
"include": [
"./src/**/*",
"../shared/**/*"
]
}
Why do I get this error if I DO have this module? Is there something I'm missing?