0

I create a quick hello world firebase function following the official tutorial. The bundled JS file is ~

const functions = require('firebase-functions');

const admin = require('firebase-admin');
admin.initializeApp();

exports.ping = functions.https.onCall(() => {
  return 'Hello world'
});

Bundling this up with esbuild the output is a whopping 8.7mb!! No wonder the cold start is so slow. How can I get this down?

Is this expected / normal?

david_adler
  • 9,690
  • 6
  • 57
  • 97
  • In the functions I've written, I just leave the source as it is - no transpilation/bundling at all. But this may change with the introduction of the [modular Admin SDK](https://firebase.google.com/docs/admin/migrate-node-v10). In the past, I've found that dealing with how you load your function's [dependencies](https://stackoverflow.com/q/73678711/3068190) and [routes](https://stackoverflow.com/q/66813496/3068190) often gives better returns. Each thread has links to more resources on the topic. – samthecodingman Apr 27 '23 at 00:41
  • It’s written in typescript so has to be transpiled – david_adler Apr 27 '23 at 08:55

0 Answers0