apostrophecms / apostrophe

A full-featured, open-source content management framework built with Node.js that empowers organizations by combining in-context editing and headless architecture in a full-stack JS environment.
https://apostrophecms.com
Other
4.37k stars 590 forks source link

HMR condition argument and widget player fix #4794

Closed myovchev closed 2 weeks ago

myovchev commented 3 weeks ago

Summary

What are the specific steps to test this change?

Players should always run during the initial page load.

The following injection:

self.apos.template.prepend({
  where: 'head',
  when: 'hmr:public',
  bundler: 'vite',
  component: 'vite-react:reactRefresh'
});

should inject the component only when HMR is on and the asset module option hmr is set to public. The generic when: 'hmr' still works as expected.

What kind of change does this PR introduce?

(Check at least one)

Make sure the PR fulfills these requirements:

If adding a new feature without an already open issue, it's best to open a feature request issue first and wait for approval before working on it.

Other information: