Ah realized that. To use ES6 features like import and const , and even ES7 features like await and async , use Typescript to rename index.js to index.ts .
Here is my index.ts :
import * as functions from 'firebase-functions'; export const helloWorld = functions.https.onRequest((req, resp) => { resp.send("Hello from Firebase!"); });
I was also asked by Atom to create the functions/tsconfig.json . I'm not sure if this was necessary, but here is what was created:
{ "compilerOptions": { "target": "es5", "module": "commonjs", "moduleResolution": "node", "isolatedModules": false, "jsx": "react", "experimentalDecorators": true, "emitDecoratorMetadata": true, "declaration": false, "noImplicitAny": false, "noImplicitUseStrict": false, "removeComments": true, "noLib": false, "preserveConstEnums": true, "suppressImplicitAnyIndexErrors": true, "lib": ["es2015", "es2015.promise"] }, "exclude": [ "node_modules", "typings/browser", "typings/browser.d.ts" ], "compileOnSave": true, "buildOnSave": false, "atom": { "rewriteTsconfig": false } }
Here is the output generated by firebase deploy --only functions :
=== Deploying to 'PROJECTNAME'... i deploying functions i functions: ensuring necessary APIs are enabled... i runtimeconfig: ensuring necessary APIs are enabled... ✔ runtimeconfig: all necessary APIs are enabled ✔ functions: all necessary APIs are enabled i functions: preparing functions directory for uploading... i functions: packaged functions (1.53 KB) for uploading ✔ functions: functions folder uploaded successfully i starting release process (may take several minutes)... i functions: creating function helloWorld... ✔ functions[helloWorld]: Successful create operation. ✔ functions: all functions deployed successfully! ✔ Deploy complete! Project Console: https://console.firebase.google.com/project/PROJECTNAME/overview Function URL (helloWorld): https://us-central1-PROJECTNAME.cloudfunctions.net/helloWorld
source share