import functions from 'firebase-functions';
import UtilModuler from '@utilModuler'
exports.helloWorld = functions.https.onRequest((request, response) => {
response.send("Hello from Firebase!");
});
import UtilModuler from '@utilModuler'; ^^^^^^^^^
SyntaxError: Unexpected identifier at Module._compile (internal/modules/cjs/loader.js:721:23)
Caveats
I'm using third party libraries(@utilModuler) which were written via import/exports. Possible workarounds:
- Fork library and generate cjs file with rollup.
- esm works like a charm but it cause unnesecary memory consumptions
Question: is there are a way how to use hybrid import cjs and esm in google cloud function?(except options which I described above)
Would be nice to use in deploy function something like --experimental-modules