fix: adjust renderBuiltUrl resolution for relative pathing #393
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.
Fix renderBuiltUrl API signature in pluginAddEntry
Fixes #384
Problem
PR #373 added
renderBuiltUrlsupport but had two critical bugs:renderBuiltUrl(file)with only one parameter, but Vite expectsrenderBuiltUrl(filename, options){runtime},{relative})This broke compatibility with any
renderBuiltUrlimplementation that depends on theoptionsparameter, causing "Cannot destructure property of undefined" errors.Solution
Updated
src/plugins/pluginAddEntry.ts(lines 135-191) to:filenameandoptionsobject withhostId,hostType,type, andssrparametersstring→ Use directly{relative: true}→ Use filename without base prefix{runtime: "code"}→ Warn and fallback (incompatible with HTML<script src="">)undefined→ Fallback to defaultbase + filehostIdTesting
renderBuiltUrlconfigured)Preserves PR #373
The fix maintains the original functionality from #373 (issue #372) -
renderBuiltUrltransformations are correctly applied to hostInit script tags.