feat(NPF-4641): add js preload link to bundles#696
Conversation
| }; | ||
|
|
||
| #getSsrFragmentScriptRefsToPreload = (fragmentsContext, apps) => { | ||
| const scriptRefs = _.reduce( |
There was a problem hiding this comment.
refrain from using lodash, planning to drop it.
There was a problem hiding this comment.
valid point, will remove it from the file
There was a problem hiding this comment.
maybe typescript here, looks like good chance for this file.
| } | ||
| } | ||
|
|
||
| export = ConfigsInjector; |
There was a problem hiding this comment.
Yes, I understand. But this is due to current consumers for the classes. This module is still consumed via plain CommonJS:
const ConfigsInjector = require('./configs-injector');
new ConfigsInjector(...)This package builds with module: "commonjs", so a normal named export like export class ConfigsInjector compiles to exports.ConfigsInjector = ConfigsInjector. In that case require('./configs-injector') returns a module object, not the constructor itself.
To allow export class ConfigsInjector, we need to update every CommonJS consumer to import the named export instead of expecting the module itself to be the constructor. I will try to update consumers then
Coverage ReportIlc/serverCommit SHA:a962821552350a8e2b94aac2c42a243bd028f2eb Test coverage results 🧪File details
Ilc/clientCommit SHA:a962821552350a8e2b94aac2c42a243bd028f2eb Test coverage results 🧪File details
RegistryCommit SHA:a962821552350a8e2b94aac2c42a243bd028f2eb Test coverage results 🧪File details
|
Summary
Add response-level JS preload
Linkheaders for SSR-rendered fragment entry bundles in ILC.Previously,
ConfigsInjector#getAssetsToPreload()only returned stylesheet refs, so TailorX could not emit preload headers for fragment JS entry bundles. This change collects SSR fragmentspaBundleUrls, includes wrapper bundles when present, and passes them through to TailorX so they are exposed asLink: ... rel="preload"; as="script"response headers.Changes
request.router.getFragmentsContext()scriptRefsfromgetAssetsToPreload()Behavior
/_ilc/client.jsout of the response preload header set