I have tried adding a section script inside a view component's view.
@section scripts {
<script src=~/somepath asp-append-version=true></script>
}
I also have the Render Section in the shared layout
@RenderSection(scripts, required: false)
When used in partial views and elsewhere in the project the script loads fine. However when in a View Component the script does not load.
I suppose I could include the script in the section tag of every view that calls the component. I feel this does not fit with the self contained nature of a view component.
Is there another way I can do this?