Files
bun.sh/test/snippets/reload/self.ts
Georgijs bd2779b029 Fix --hot with empty file, make --hot faster on windows (#8708)
* reduce watcher timeout in windows, fix hot reload with empty files

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-02-05 14:40:18 -08:00

9 lines
431 B
TypeScript

// const content = await Bun.file(import.meta.path).text();
const content = require("fs").readFileSync(import.meta.path, "utf8");
const timebegin = content.indexOf("\n// time:");
const prev = parseFloat(content.substring(timebegin + 9));
const current = performance.now() + performance.timeOrigin;
console.log(current - prev);
require("fs").writeFileSync(import.meta.path, content.substring(0, timebegin + 9) + current);
// time:0