Skip to content

Commit

Permalink
fix(dev): do not trigger rebuild when .DS_Store changes (#7172)
Browse files Browse the repository at this point in the history
  • Loading branch information
pcattori authored Aug 15, 2023
1 parent 65fdbcd commit ae92f57
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/shiny-teachers-cheer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@remix-run/dev": patch
---

do not trigger rebuilds when .DS_Store changes
8 changes: 8 additions & 0 deletions packages/remix-dev/compiler/watch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ export type WatchOptions = {
onFileDeleted?(file: string): void;
};

function shouldIgnore(file: string): boolean {
let filename = path.basename(file);
return filename === ".DS_Store";
}

export async function watch(
ctx: Context,
{
Expand Down Expand Up @@ -120,10 +125,12 @@ export async function watch(
})
.on("error", (error) => ctx.logger.error(String(error)))
.on("change", async (file) => {
if (shouldIgnore(file)) return;
onFileChanged?.(file);
await rebuild();
})
.on("add", async (file) => {
if (shouldIgnore(file)) return;
onFileCreated?.(file);

try {
Expand All @@ -136,6 +143,7 @@ export async function watch(
await (isEntryPoint(ctx.config, file) ? restart : rebuild)();
})
.on("unlink", async (file) => {
if (shouldIgnore(file)) return;
onFileDeleted?.(file);
await (isEntryPoint(ctx.config, file) ? restart : rebuild)();
});
Expand Down

0 comments on commit ae92f57

Please sign in to comment.