simondotm / nx-firebase

Firebase plugin for Nx Monorepos
https://www.npmjs.com/package/@simondotm/nx-firebase
MIT License
175 stars 31 forks source link

build executor may need to respect node version #8

Closed simondotm closed 3 years ago

simondotm commented 3 years ago

I've come up against this possibility with Firebase + Nx, where Nx workspace/user environment uses Node version 15 (for example) but our Firebase functions package engine is set to 10. For CI builds of the functions, we need to be confident that building functions via nx using a node version other than the one specified in the functions package.json will generate output JS that is compatible with firebase functions when deployed.

simondotm commented 3 years ago

I've already set module: "commonjs" which should be fine until such time that FB supports ES modules.

Current thinking is: For node 10, tsconfig target can be no greater than es2018 For node 12, tsconfig target can be no greater than es2019 These settings are typically in the Nx workspace root tsconfig.base.json so we might need to override them in the functions typescript.app.json

For any functions that import any node API's, I'm not yet sure how to properly enforce that if the build node environment is not the same as the engine setting for the functions package.

simondotm commented 3 years ago

I've added es2018 as a tsc compiler target so lets close this and see if any further issues crop up.