aboutsummaryrefslogtreecommitdiff
path: root/src/cache.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/cache.zig')
-rw-r--r--src/cache.zig7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/cache.zig b/src/cache.zig
index 4585860fa..56d91618d 100644
--- a/src/cache.zig
+++ b/src/cache.zig
@@ -294,6 +294,13 @@ pub const Json = struct {
};
}
pub fn parseJSON(cache: *@This(), log: *logger.Log, source: logger.Source, allocator: std.mem.Allocator) anyerror!?js_ast.Expr {
+ // tsconfig.* and jsconfig.* files are JSON files, but they are not valid JSON files.
+ // They are JSON files with comments and trailing commas.
+ // Sometimes tooling expects this to work.
+ if (source.path.isJSONCFile()) {
+ return try parse(cache, log, source, allocator, json_parser.ParseTSConfig);
+ }
+
return try parse(cache, log, source, allocator, json_parser.ParseJSON);
}