fix: improve pnpm link compatibility and file path resolution #419
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
Resolves
MODULE_NOT_FOUNDerrors when usingpnpm linkfor local development.This fix enables smooth contributor workflow for testing unpublished changes in real projects.
Problems Solved
node_modules/.code-inspector/instead of the plugin's installation directoryRoot Cause
When
code-inspector-pluginis linked viapnpm link, the hardcoded NPM-style import pathcode-inspector-plugin/dist/append-code-*.jscausedMODULE_NOT_FOUNDerrors. This occurred because:node_modulesSolution
Changed
writeWebComponentFileto:node_modules/.code-inspector/)This ensures imports resolve correctly with:
pnpm link/npm link/yarn linkUse Cases Enabled
✅ Local development with linked packages
✅ Testing unpublished changes before release
✅ Better contributor development workflow
✅ Monorepo development scenarios
Changes
Files modified:
packages/core/src/server/use-client.ts: Relative path import generationpackages/code-inspector-plugin/src/index.ts: Use project cache directorypackages/core/src/shared/record-cache.ts: Safe directory creationImpact:
Testing
pnpm linkin Next.js project