fix: use symlink instead of NODE_PATH for ESM dependency resolution#41
Merged
Conversation
NODE_PATH is completely ignored by Node.js ES modules. Replace the non-functional env.NODE_PATH in the MCP server config with a symlink created by the SessionStart hook that places node_modules in the plugin root where ESM resolution expects it. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
NODE_PATHis completely ignored by Node.js ES modules — the existingenv.NODE_PATHin the MCP server config had no effect, causing dependency resolution to failSessionStarthook now symlinks${CLAUDE_PLUGIN_ROOT}/node_modules→${CLAUDE_PLUGIN_DATA}/node_modulesso ESM resolution finds packages in the standard locationenv.NODE_PATHfrom the MCP server configTest plan
claude plugin addin a fresh project${CLAUDE_PLUGIN_ROOT}/node_moduleson session startget_connection_status)html2canvasresolves correctly viacreateRequire(test/html2canvas.min.jsendpoint)🤖 Generated with Claude Code