-
Notifications
You must be signed in to change notification settings - Fork 2k
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
SSR: Fix file-loader assets #36204
SSR: Fix file-loader assets #36204
Conversation
Output files once to images and share the output across builds.
Here is how your PR affects size of JS and CSS bundles shipped to the user's browser: Webpack Runtime (~124 bytes removed 📉 [gzipped])
Webpack runtime for loading modules. It is included in the HTML page as an inline script. Is downloaded and parsed every time the app is loaded. App Entrypoints (~2 bytes removed 📉 [gzipped])
Common code that is always downloaded and parsed every time the app is loaded, no matter which route is used. Sections (~1606 bytes added 📈 [gzipped])
Sections contain code specific for a given set of routes. Is downloaded and parsed only when a particular route is navigated to. Async-loaded Components (~91 bytes added 📈 [gzipped])
React components that are loaded lazily, when a certain part of UI is displayed for the first time. Legend What is parsed and gzip size?Parsed Size: Uncompressed size of the JS and CSS files. This much code needs to be parsed and stored in memory. Generated by performance advisor bot at iscalypsofastyet.com. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, works for me.
Tested the IE11 behaviour and got what was expected: gridicons only show in IE11 when JS is enabled.
I thought it'd be better to use a shared constant instead of the '/calypso/images'
literal. But from searching around I see that this base url is pretty entrenched in magic strings at this stage 🤷♂
@sirreal I just rebased the branch I was working on #36069 and I am now getting 404 on a bunch of gridicons related stuff:
Reverting this change seems to fix this issue. |
Thanks @xknown, this did introduce a regression in development via |
The fix for SSR file-loader URLs from #36204 caused a regression in development. This was due to the way `publicPath` is hard-coded in the server's webpack-dev-middleware. When in that environment, use matching output and public path.
* Output file-loader files in development * Fix file-loader assets in development The fix for SSR file-loader URLs from #36204 caused a regression in development. This was due to the way `publicPath` is hard-coded in the server's webpack-dev-middleware. When in that environment, use matching output and public path. * Only emitFile once * Fix the URLs of SSR-ed images by configuring the server file-loader, too
Output
file-loader
files once and share the output files across builds.Currently, SSR does not show any icons because of a path mismatch.
I suspect this was a regression from #30768 which started to affect icons after #32763
Reported by @michaeldcain
Screens
Before
SSR
Paths like
images/file.ext#id
Rendered
Paths like
/calypso/evergreen/images/file.ext#id
After
SSR
Paths like
/calypso/images/file.ext#id
Rendered
Paths like
/calypso/images/file.ext#id
Testing instructions
Repeat with a legacy browser (ensure JavaScript assets are coming from the fallback URL).Some legacy browsers are rendered without external SVG support so they rely on JavaScript to render icons. Just trust that they work 😅