Include base in hotFile without modifying server.origin replacement #296
  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.
  
    
  
    
Unfortunately #290 - while fixing the
hotFileproblem - broke the transform function's origin replacement when using a base in the configuration resulting in broken asset URLs.Vite generates URLs using the
originand thebase. As this plugin now replaces theorigin(__laravel_vite_placeholder__) by default with theorigin+base, the base is included twice in the asset URLs, which results in the given assets not loading.On the other hand, the original problem that #290 solved was real as well, as Laravel did not take the
baseinto account before this PR and the main files did not load when settingbasein the configuration. This means that thebasehas to be included in thehotFile. It should also be included when setting theoriginexplicitly, which is a special case that #290 did not handle.This pull request includes the
basein thehotFile, but leaves the origin (or more precisely the replacement) as is. This should both solve the original problem and avoid including thebasein the asset URLs twice.public/hotcontenthttps://test.localhost:443/vite-test-basehttps://test.localhost:443/vite-test-basehttps://test.localhost/vite-test-base/vite-test-base/resources/images/test.svghttps://test.localhost/vite-test-base/resources/images/test.svghttps://test.localhost/vite-test-base/node_modules/.vite/deps/chunk-NDQ3I6BD.js?v=df756ebehttps://test.localhost/vite-test-base/node_modules/.vite/deps/chunk-NDQ3I6BD.js?v=df756ebeThis change should not be a breaking change as it is a fix to something that changed in vite 5 compared to vite 4 as mentioned here.