diff --git a/packages/bruno-electron/src/app/collections.js b/packages/bruno-electron/src/app/collections.js index ec2cdacc2..5c9889e13 100644 --- a/packages/bruno-electron/src/app/collections.js +++ b/packages/bruno-electron/src/app/collections.js @@ -63,7 +63,10 @@ const openCollection = async (win, watcher, collectionPath, options = {}) => { const uid = generateUidBasedOnHash(collectionPath); if (!brunoConfig.ignore || brunoConfig.ignore.length === 0) { - // Forces default behavior for legacy collections + // 5 Feb 2024: + // bruno.json now supports an "ignore" field to specify which folders to ignore + // if the ignore field is not present, we default to ignoring node_modules and .git + // this is to maintain backwards compatibility with older collections brunoConfig.ignore = ['node_modules', '.git']; } diff --git a/packages/bruno-electron/src/app/watcher.js b/packages/bruno-electron/src/app/watcher.js index 23a2c565c..441bba3b2 100644 --- a/packages/bruno-electron/src/app/watcher.js +++ b/packages/bruno-electron/src/app/watcher.js @@ -414,7 +414,15 @@ class Watcher { const watcher = chokidar.watch(watchPath, { ignoreInitial: false, usePolling: watchPath.startsWith('\\\\') ? true : false, - ignored: (path) => ignores.some((s) => path.includes(s)), + ignored: (filepath) => { + const normalizedPath = filepath.replace(/\\/g, '/'); + const relativePath = path.relative(watchPath, normalizedPath); + + return ignores.some((ignorePattern) => { + const normalizedIgnorePattern = ignorePattern.replace(/\\/g, '/'); + return relativePath === normalizedIgnorePattern || relativePath.startsWith(normalizedIgnorePattern); + }); + }, persistent: true, ignorePermissionErrors: true, awaitWriteFinish: {