I'm trying to split a large cloud function into a smaller more maintainable files. However when deploying I always get the same error:
Error occurred while parsing your function triggers.
/Users/Raphi/Documents/Programing/Development/merchantAPI/functions/index.js:2
import { DirectPost } from '../functions/merchantPost';
^^^^^^
SyntaxError: Cannot use import statement outside a module
I spent most of last night googling but there doesn't seem to be any documentation for this
simplified index.js:
import { DirectPost } from '../functions/merchantPost';
exports.portal = functions.https.onRequest(async (request, response) => {
var charge = new DirectPost()
})
simplified merchantPost.js:
export class DirectPost {
constructor(){}
}