RuntimePlugin
is used to generate the code for the Rspack startup. It provides the following hooks that can be used to modify these runtime codes.
You can obtain these hooks like below:
createScript
SyncWaterallHook<[string, chunk]>
Can modify the code executed when creating the <script>
tag.
As in the following code, the crossorigin
attribute can be added to the <script>
tag:
linkPrefetch
SyncWaterallHook<[string, chunk]>
Can modify the code executed when creating the prefetch <link rel="prefetch">
tag.
As in the following code, the crossorigin
attribute can be added to the <link>
tag for prefetching:
linkPreload
SyncWaterallHook<[string, chunk]>
Can modify the code executed when creating the preload <link rel="preload">
tag.
As in the following code, the crossorigin
attribute can be added to the <link>
tag for preloading: