I am trying to get sourcemaps to work, when developing firebase functions in typescript.
In my tsconfig.json
file a have source maps enabled.
This generated the sourcemaps. I then include this line in my index.ts
file:
import 'source-map-support/register';
And then it seems to work. Is this correct configured, and source-map-support
to the projects package.json
file?
Yes, you need to do a few things, some of which is documented here:
npm install source-map-support
Enable sourceMap
in tsconfig.json
(not package.json!) by adding:
"compilerOptions": {
"sourceMap": true,
...
},
import 'source-map-support/register'
require('source-map-support').install();
the result would transform this:
TypeError: Cannot read property 'current_location' of null
at /user_code/lib/http_actions.js:173:74
at next (native)
at fulfilled (/user_code/lib/http_actions.js:4:58)
at process._tickDomainCallback (internal/process/next_tick.js:135:7)
into this:
TypeError: Cannot read property 'current_location' of null
at /user_code/src/http_actions.ts:183:33
at next (native)
at fulfilled (/user_code/lib/http_actions.js:4:58)
at process._tickDomainCallback (internal/process/next_tick.js:135:7)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With