Are there any disadvantages or considerations I should be aware of when enabling source maps in a production environment for a Node.js application?
I have a production Node.js application that is written in TypeScript. Currently, when errors are thrown, they are logged to the standard output. However, the resulting stack traces are not easily readable due to the code being transpiled.
To address this issue during local development, I utilize the --enable-source-maps
flag of Node.js, which provides more coherent stack traces.
Given that this is a back-end application and any errors are not directly exposed to the client, I am contemplating enabling source maps in the production environment as well.
I am already utilizing an error tracking service for additional error handling.
I understand your concern regarding the use of source maps and their impact on security and performance.
Given that this is a back-end application and any errors are not directly exposed to the client
In this case, the issue is not with security but with performance. If your application is not sensitive to performance, you can safely use source maps. However, there may be some unexpected situations that arise, such as the one mentioned in this GitHub issue: https://github.com/nodejs/node/issues/41541.