Open EvanBacon opened 9 months ago
Where is the bad source location coming from? This kinda looks like it masks a genuine bug elsewhere. Do you have repro steps? Also, we have tests for this code now, might be worth adding a regression test to cover the fix.
@motiz88 If you have a babel plugin which takes an empty file like ""
and injects a bunch of imports:
import "missing"
import "missing2"
Then the resolver will throw an error which breaks the formatter because it attempts to read lines that don't exist on-disk.
Summary
If you have a module that has
import
statements generated in the transformer, then it could possibly throw a resolver error on a line that won't exist in the on-disk file. Without this change, the process will throw an unhandled error. Here, we just skip the error improvement step and fallback on the default behavior.