webpack: Use CORS requests for stylesheets.

This seems to be required for webpack-dev-server 5.2.1, for reasons
that have not yet been made public.  This relies on the
Access-Control-Allow-Origin: * header that we already set for static
content in both development and production.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg
2025-04-10 12:23:19 -07:00
committed by Tim Abbott
parent ab24eea83e
commit bdd11577bf

View File

@@ -30,7 +30,7 @@
{% block webpack %}
{% for filename in webpack_entry(entrypoint) -%}
{% if filename.endswith(".css") -%}
<link href="{{ filename }}" rel="stylesheet" {% if csp_nonce %}nonce="{{ csp_nonce }}"{% endif %} />
<link href="{{ filename }}" rel="stylesheet" crossorigin="anonymous" {% if csp_nonce %}nonce="{{ csp_nonce }}"{% endif %} />
{% elif filename.endswith(".js") -%}
<script src="{{ filename }}" defer crossorigin="anonymous" {% if csp_nonce %}nonce="{{ csp_nonce }}"{% endif %}></script>
{% endif -%}