firebase-functions-es6-example icon indicating copy to clipboard operation
firebase-functions-es6-example copied to clipboard

Use ES6 to develop Cloud Functions for Firebase today!

[DEPRECATED] ES6+ in Cloud Functions for Firebase

This example is deprecated in favour of ES6+ in Cloud Functions 2 and it's folder in my blog-examples repo.


Use ES6+ to develop Cloud Functions for Firebase today!

Here is the accompanying Medium post.

TLDR;

Develop your Coud Functions in a different directory to the default ./functions directory. I suggest ./functionsES6. Then use babel-cli, babel-preset-es2015 and rimraf with some npm scripts to transpile to ES2015 into the default ./functions directory on deploy (yarn deploy).

Files of interest:

Installation

git clone https://github.com/jthegedus/firebase-functions-es6-example
cd firebase-functions-es6-example
yarn install

Deploy to Firebase

yarn deploy

N.B.: You will need to connect the project to your Firebase project. Edit the name in .firebaserc

A note on Code Compatibility

Everything was tested on Ubuntu 17.04. If you wish for Windows native support please submit an issue so we can work on a Windows branch. Please report any macOS errors as I do not have access to a device to test. My development environment can be found here.