You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The transform steps done inside both of those optimization passes seem to ignore input source maps, regardless of whether they are passed inline or not. This may well be an issue with Babel rather than Metro. Indeed, it may even be desired behaviour in babel, but metro should probably be mapping between compiled and input code properly :)
However, even if you patch inline to set code: true, the emitted map appears to be based only on the code passed to the transform step, completely ignoring the inputSourceMap property.
I've done a few hours trying to debug this but gotten nowhere. Maybe one of you can look at it?
Hey peeps! Nice work splitting this off from react-native :)
It seems that, despite best intentions, input source maps get ignored when bundling for release. Here is the culprit: https://github.com/facebook/metro-bundler/blob/e87a8205d8ca070df0fcef67dbe4f02389770b95/packages/metro-bundler/src/JSTransformer/worker/index.js#L126
The transform steps done inside both of those optimization passes seem to ignore input source maps, regardless of whether they are passed inline or not. This may well be an issue with Babel rather than Metro. Indeed, it may even be desired behaviour in babel, but metro should probably be mapping between compiled and input code properly :)
The first place that the input source map gets left behind is during the
inline
operation. Notice that it transforms the input with the babel optionsource
set tofalse
- When you do that, babel never outputs amap
property during the File#generate method because it ends up calling File#makeResult in such a way that it is impossible for amap
to be emitted.However, even if you patch
inline
to setcode: true
, the emitted map appears to be based only on thecode
passed to the transform step, completely ignoring theinputSourceMap
property.I've done a few hours trying to debug this but gotten nowhere. Maybe one of you can look at it?
I made a failing test over here: https://github.com/ds300/metro-bundler/blob/aadd5d8303ac99c8d5e5918ac752ca90b1c2fbdb/packages/metro-bundler/src/JSTransformer/worker/__tests__/source-mapping-test.js
Thanks ❤️
The text was updated successfully, but these errors were encountered: