aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/resolver/resolver.zig6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/resolver/resolver.zig b/src/resolver/resolver.zig
index 4a3fffb8a..3d7404a17 100644
--- a/src/resolver/resolver.zig
+++ b/src/resolver/resolver.zig
@@ -1358,7 +1358,10 @@ pub const Resolver = struct {
false,
null,
);
- const key_path = Path.init(file);
+ // The file name needs to be persistent because it can have errors
+ // and if those errors need to print the filename
+ // then it will be undefined memory if we parse another tsconfig.json late
+ const key_path = try Path.init(file).dupeAlloc(r.allocator);
const source = logger.Source.initPathString(key_path.text, entry.contents);
const file_dir = source.path.sourceDir();
@@ -1366,6 +1369,7 @@ pub const Resolver = struct {
var result = (try TSConfigJSON.parse(r.allocator, r.log, source, &r.caches.json, r.opts.jsx.development)) orelse return null;
if (result.hasBaseURL()) {
+
// this might leak
if (!std.fs.path.isAbsolute(result.base_url)) {
const paths = [_]string{ file_dir, result.base_url };