Skip to content

Commit

Permalink
✨ Export __loader_exclude = true to exclude a file from loading
Browse files Browse the repository at this point in the history
  • Loading branch information
daniwasonline committed Jun 2, 2024
1 parent b2fc6f4 commit 606c294
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/util/loaders.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,13 @@ export async function loadStructures(dir, predicate, recursive = true, allowInde
}

// Import the structure dynamically from the file
const structure = (await import(`${dir}/${file}`)).default;
const imported = await import(`${dir}/${file}`);
const structure = imported.default;

// Exclude anything with __loader_exclude = true exported
if (imported.__loader_exclude) {
continue;
}

// If the structure is a valid structure, add it
if (predicate(structure)) structures.push(structure);
Expand Down

0 comments on commit 606c294

Please sign in to comment.