No description
Find a file
Tobias Koppers 44f23bd5da improve error reporting of JSON parsing (vercel/turbo#3676)
also make source context generation more reusable

This adds a source context snippet of the JSON that failed parsing and
the json path to the error.

```
An error occurred while generating the chunk item [project]/crates/turbopack-tests/tests/snapshot/imports/json/input/invalid.json (json)
  at Execution of module_factory failed
  at Execution of JsonChunkItem::content failed
  at Unable to make a module from invalid JSON: expected `,` or `}` at line 3 column 26
  at nested.?
     1 | {
     2 |   "nested": {
       |                          v
     3 |     "this-is": "invalid" // lint-staged will remove trailing commas, so here's a comment
       |                          ^
     4 |   }
     5 | }
```
2023-02-08 10:17:42 +01:00
packages/next-swc/crates improve error reporting of JSON parsing (vercel/turbo#3676) 2023-02-08 10:17:42 +01:00