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

fix: setting assetPrefix to URL format breaks HMR #70040

Merged
merged 3 commits into from
Sep 12, 2024
Merged

fix: setting assetPrefix to URL format breaks HMR #70040

merged 3 commits into from
Sep 12, 2024

Commits on Sep 12, 2024

  1. Configuration menu
    Copy the full SHA
    4087a2a View commit details
    Browse the repository at this point in the history
  2. chore: remove asset prefix warning log and update docs (#68681)

    ### Why?
    
    In #68622 we fixed a bug that HMR
    breaks when `assetPrefix` is set to full URL.
    The fix was targeted to the edge case where the user may set `localhost`
    to the `assetPrefix`, and technically, when the request is valid the HMR
    should work.
    
    However, we do not recommend this pattern as the `assetPrefix` is
    intended to be used for setting a CDN URL.
    
    ### How?
    
    Therefore we modify the docs to gently imply that the `assetPrefix` is
    for CDN URL.
    Also, removed the warning log that could be confusing whether we support
    it or not.
    Setting localhost will still work, but we do not mention about it within
    the app.
    devjiwonchoi committed Sep 12, 2024
    Configuration menu
    Copy the full SHA
    5999a6d View commit details
    Browse the repository at this point in the history
  3. fix: normalize-asset-prefix adding leading slash when URL `assetPre…

    …fix` is provided (#68518)
    
    ### Why?
    
    URL validation of `normalizeAssetPrefix` was wrong as it checks if is
    starting with `://`:
    
    
    https://github.com/vercel/next.js/blob/37df9ab243690187725a236cbf2debbcaeb33cfa/packages/next/src/shared/lib/normalized-asset-prefix.ts#L4-L7
    
    This resulted the value to be `/https://example.com` instead of
    `example.com`.
    
    x-ref:
    #68518 (comment)
    
    ### How?
    
    As `normalizeAssetPrefix` function was added for `getSocketUrl`, it
    removes the protocol of the URL.
    But for reusability, this could be a friction to other callers.
    Therefore we validate the URL and let the callers handle the URL (e.g.
    protocol).
    devjiwonchoi committed Sep 12, 2024
    Configuration menu
    Copy the full SHA
    725c6da View commit details
    Browse the repository at this point in the history