firebase / firebase/firebase-tools
Pass `NODE_OPTIONS` when spawning `firebase-functions` to enable TS support in the emulator
Open
emulators: functions
type: feature request
- Dominant language
- TypeScript
- Stars
- 4.5k
- Forks
- 1.3k
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 84
Description
https://github.com/firebase/firebase-tools/blob/f4581809c3af60fe58c10a143df0679f76d4b216/src/deploy/functions/runtimes/node/index.ts#L162-L171
By adding `NODE_OPTIONS: process.env.NODE_OPTIONS`, we'll be able to enable TS support in userland in the emulator simply by installing `@esbuild-kit/esm-loader` (or anything similar) and using the following script to run:
```sh
NODE_OPTIONS='--loader=@esbuild-kit/esm-loader' firebase emulators:start
```
Solves: https://github.com/firebase/firebase-tools/issues/5633
Contributor guide
Assessment
This issue has not been assessed yet.