The firebase.json
should be in the root of the workspace and it only shows the relevant bits.
Put the webpack config into modules/firebase/
Before deploying the functions, build the function bundle with webpack
(it will end up in dist/
).
{ | |
"functions": { | |
"source": "modules/firebase/dist" | |
}, | |
} |
const path = require('path') | |
module.exports = { | |
target: 'node', | |
mode: 'production', | |
entry: path.resolve(__dirname, 'src', 'index.ts'), | |
module: { | |
rules: [ | |
{ | |
test: /\.tsx?$/, | |
use: 'ts-loader', | |
exclude: /node_modules/, | |
}, | |
], | |
}, | |
resolve: { | |
extensions: ['.tsx', '.ts', '.mjs', '.js', '.json'], | |
}, | |
output: { | |
filename: 'index.js', | |
path: path.resolve(__dirname, './dist'), | |
libraryTarget: 'commonjs', | |
}, | |
externals: { | |
'firebase-admin': 'firebase-admin', | |
'firebase-functions': 'firebase-functions', | |
}, | |
} |