Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update v4 migration guide per breaking change with data URLs #17319

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Commits on May 26, 2024

  1. Update v4 migration guide per breaking change with data URLs

    Adding this note to the migration guide because it took me quite some time to track it down when migrating from vite v4.5.3 to v5.2.11. My hope is that I can save others the aggravation.
    
    Problem:
    After I upgraded from v4.5.3 to v5.2.11 everything in my application seemed to work except that small SVG assets were broken because they were now rendering as data URLs.
    
    My first attempt at figuring out why was unsuccessful so I reverted the migration.
    I came back several weeks later to try again and this time tracked it down to the `build.assetsInlineLimit` configuration setting (https://vitejs.dev/config/build-options.html#build-assetsinlinelimit). By disabling that (setting it to zero) I no longer had data URLs and then all my SVG assets loaded successfully.
    
    I have run trials...
    - with absolute URLs and relative URLs
    - with CDN base URL and without
    - in Chrome and in Firefox
    None of those made a difference.
    Bottom line: When I did not have `assetsInlineLimit` in my configuration file, with vite 4.5.3 there were no data URLs (and thus no failing images), while with vite 5.2.11 there were data URLs (and thus failing images). 
    
    Expected:
    <img src="/assets-new/ship-ZuEbWyOy.svg" class="logo">
    -- OR --
    <img src="https://dl.myBaseUrl.com/ui/assets-new/ship-ZuEbWyOy.svg" class="logo">
    
    Actual:
    <img src="/data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='101'%20height='32'%20fill='none'%3e%3cg%20clip-path...
    msorens committed May 26, 2024
    Configuration menu
    Copy the full SHA
    f6370ee View commit details
    Browse the repository at this point in the history