Fix circular import causing "Could not resolve" error during installation #9
+4,078
−1
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.
Problem
Users were unable to install or use the package due to a bundler error:
Root Cause
The
src/index.jsfile was using a self-referential import path:This created a circular dependency where the package was trying to import from itself. When bundlers (like esbuild, Vite, Webpack) tried to resolve this path, they failed because
vue3-simple-html2pdf/src/vue3-simple-html2pdfis not a valid module export path.Solution
Changed the import to use a relative path instead:
This correctly resolves to the Vue component file in the same directory, eliminating the circular dependency.
Verification
Tested with esbuild to confirm the fix:
Before (broken):
After (working):
The second error is expected and correct—users need to configure their bundler to handle
.vuefiles, which is standard practice for Vue projects. The important change is that the import path now resolves successfully.Impact
Fixes #[issue_number]
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.