Skip to content

Conversation

@lightninglu10
Copy link
Contributor

Summary

  • Extracted duplicate /index handling logic into a reusable helper method addModuleMapEntry
  • Eliminates code duplication in src/webpack-plugin.ts where the same pattern appeared twice
  • Improves maintainability and reduces risk of inconsistencies between code paths

Changes

The pattern for handling index files (adding both the regular entry and a variant without the /index suffix) was duplicated in two places:

  1. Lines 438-450 (concatenated modules handling)
  2. Lines 576-586 (regular module handling)

Created a private helper method that:

  • Adds the main entry to moduleMap
  • Automatically adds an entry without the /index suffix for index files
  • Ensures consistent behavior across both code paths

Test Plan

  • ✅ Build passes (npm run build)
  • ✅ All tests pass (npm test)
  • ✅ No functional changes - pure refactoring

🤖 Generated with Claude Code

Extract duplicate `/index` handling logic into a private helper method
`addModuleMapEntry` to avoid code duplication. The pattern of adding
both the regular entry and the `/index` variant to the module map
appeared twice in the webpack plugin and is now consolidated into a
single reusable method.

This improves maintainability and reduces the risk of inconsistencies
between the two code paths.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

❇️ CodePress Review Summary

👋 Hey team,

Overall the changes look great! No specific issues found.

Here's the quick rundown:

✅ Decision: APPROVE
The change is a straightforward refactor that maintains existing behavior. No clear blocking correctness, security, or performance issues are evident; potential aliasing concerns are non-blocking.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@lightninglu10 lightninglu10 merged commit 2e4b1b5 into main Nov 29, 2025
7 checks passed
@lightninglu10 lightninglu10 deleted the fix/extract-index-helper branch November 29, 2025 20:28
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.

2 participants