Skip to content

Conversation

@sclark-bycore
Copy link

@sclark-bycore sclark-bycore commented Oct 22, 2025

Description

Fixes the issue where the icon scanner recursively scans all directories from the project root, including node_modules, causing build failures when dependencies contain unsupported syntax (e.g., TypeScript decorators).

Problem

The scanner had two main issues:

  1. Config loading from zero-ui.config.js was completely commented out in dist/config.js
  2. Default ROOT_DIR was "" (empty string), causing the scanner to traverse the entire project including node_modules

This caused build failures with packages like @hookform/resolvers that contain decorator syntax:

SyntaxError: Support for the experimental syntax 'decorators' isn't currently enabled

Solution

✅ Enabled config loading from zero-ui.config.js
✅ Changed default ROOT_DIR from "" to "src"
✅ Added EXCLUDE_DIRS configuration with sensible defaults: ["node_modules", ".git", "dist", "build", ".next", "out"]
✅ Updated scanner to respect EXCLUDE_DIRS when traversing
✅ Added comprehensive test suite (8 new tests)
✅ Created unified test runner for better DX

Breaking Changes

None - this is fully backward compatible:

  • Projects without config will use new sensible defaults
  • Existing projects can override via zero-ui.config.js

Testing

All tests pass (including new tests):

npm test

Test coverage includes:

  • Icon mapping tests (1611 icons verified)
  • Config loading tests (default, custom, partial, invalid configs)
  • Scanner exclusion tests (directory exclusion logic)

Configuration Example

Users can now create zero-ui.config.js:

export default {
  ROOT_DIR: "app",
  EXCLUDE_DIRS: ["node_modules", "vendor", "tmp"],
};

Related Issues

Fixes #3

…oading

This commit fixes the issue where the icon scanner recursively scans all
directories from the project root, including node_modules, causing build
failures when dependencies contain unsupported syntax (e.g., TypeScript
decorators in @hookform/resolvers).

Changes:
- Enable config loading from zero-ui.config.js (was completely commented out)
- Change default ROOT_DIR from "" (project root) to "src"
- Add EXCLUDE_DIRS configuration with sensible defaults
- Update scanner to respect EXCLUDE_DIRS when traversing directories
- Add comprehensive test suite for config loading and directory exclusion
- Create unified test runner for better DX
- Update README with configuration documentation

Breaking Changes: None (backward compatible)
- Projects without config will use new sensible defaults
- Existing projects can override via zero-ui.config.js

Fixes: Scanner failing on node_modules with decorator syntax
Copy link
Member

@Austin1serb Austin1serb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will run this against several production apps using this library at this time, and if everything checks out, you can expect a merge.

Thank you for your hard work

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I appreciate you writing the comprehensive tests for this PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

zero-icons scans node_modules causing build failures

2 participants