What is the problem this feature will solve?
There hasn't been a way to reliably check if source maps are enabled since Node v16.6.
Since source maps could really slow down performance, back porting the getter so that Node Loaders can be smarter about generating source maps seems like a big win at a small cost.
What is the feature you are proposing to solve the problem?
In tsx, the loader must always generate source maps just in case it's enabled, which is expensive.
We're unable to drop source map generation until Node v20 because of this limitation: https://github.com/privatenumber/tsx/discussions/386
Bonus: it seems like Node v20 also has a performance optimization to only load source maps when Error.stack is accessed. Would be nice to have that in Node 18 too.
What alternatives have you considered?
Since source maps can be enabled programmatically since Node 16.6.0, there's no other way to detect if it's enabled.
What is the problem this feature will solve?
There hasn't been a way to reliably check if source maps are enabled since Node v16.6.
Since source maps could really slow down performance, back porting the getter so that Node Loaders can be smarter about generating source maps seems like a big win at a small cost.
What is the feature you are proposing to solve the problem?
In tsx, the loader must always generate source maps just in case it's enabled, which is expensive.
We're unable to drop source map generation until Node v20 because of this limitation: https://github.com/privatenumber/tsx/discussions/386
Bonus: it seems like Node v20 also has a performance optimization to only load source maps when
Error.stackis accessed. Would be nice to have that in Node 18 too.What alternatives have you considered?
Since source maps can be enabled programmatically since Node 16.6.0, there's no other way to detect if it's enabled.