boolean | 'anonymous' | 'use-credentials'
false
Set the crossorigin attribute of the <script>
and <style>
tags.
true
is passed, it will automatically be set to crossorigin="anonymous"
.false
is passed, it will not set the crossorigin
attr.After compilation, the <script>
tag in HTML becomes:
The <style>
tag becomes:
If the domain of static assets is the same as the current page, Rsbuild will not add the crossorigin="anonymous" attribute, as this attribute is not required for non-cross-domain scenario.
crossorigin
can the set to the following values:
anonymous
: Request uses CORS headers and credentials flag is set to 'same-origin'. There is no exchange of user credentials via cookies, client-side SSL certificates or HTTP authentication, unless destination is the same origin.use-credentials
: Request uses CORS headers, credentials flag is set to 'include' and user credentials are always included.