Fonts are loaded from assetPrefix
client-side only
#39722
Labels
bug
Issue was opened via the bug report template.
assetPrefix
client-side only
#39722
Verify canary release
Provide environment information
What browser are you using? (if relevant)
No response
How are you deploying your application? (if relevant)
next start
Describe the Bug
Thanks to
assetPrefix
, it's easy to use a CDN for JS and CSS code.However, it is interfering with fonts and is not working as expected.
It appears that the client code uses the
assetPrefix
for fonts, but the server-side generated code is not using it, creating mismatched requests.Important note: our environment variables are used at runtime and not at build time, because we reuse the build for different environments.
Expected Behavior
Fonts to be handled consistently by
assetPrefix
. It should either work like JS and CSS file, or not be handled at all.Link to reproduction
https://github.com/florian-milky/asset-font-bug
To Reproduce
1- npm run build
2- npm run copy
3- npx serve -C -p 3006 and in another tab: npm run start
4- open http://localhost:3000/
5- Debug network requests. Observe that font is preloaded from localhost:3000 and then loaded from localhost:3006
The text was updated successfully, but these errors were encountered: