Conversation
There was a problem hiding this comment.
Pull request overview
Updates the Astro image component to ensure the bcms-image custom element behavior is available in the browser by loading its module at runtime.
Changes:
- Import
./image.tsas a URL for runtime loading. - Inject a
<script type="module" ...>tag before rendering<bcms-image>.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| <> | ||
| <script | ||
| type="module" | ||
| set:html={`if (typeof window !== 'undefined' && 'customElements' in window && !customElements.get('bcms-image')) { import('${imageModuleUrl}'); }`} |
There was a problem hiding this comment.
The inline module script is injected via set:html, which introduces an inline-script requirement that can be blocked by strict Content-Security-Policy (no unsafe-inline). To keep this component usable in CSP-restricted apps (and reduce per-image script duplication), prefer loading the web component via an external module script (src pointing at the built URL) or require consumers to import/register the element once at the app/layout level.
| set:html={`if (typeof window !== 'undefined' && 'customElements' in window && !customElements.get('bcms-image')) { import('${imageModuleUrl}'); }`} | |
| src={imageModuleUrl} |
No description provided.