How do I enable and weight fields through .yml? I have a custom module where I succesfully created a field for videos. But I want the field to be enabled and weighted on by default. I supposed active and widget->weigth and display->weight was the way to go but it's disabled.

id: media.field_video_alt_text
field_name: field_video_alt_text
entity_type: media
bundle: video
label: 'Alternativ tekst'
description: 'Kort beskrivelse som vises under videoen. Lad feltet være tomt, hvis dette ikke ønskes.'
required: false
translatable: true
default_value: {  }
default_value_callback: ''
settings: {  }
field_type: string
active: true
widget:
  weight: 2
display:
  weight: 1
  label: hidden
Adding formatters or widgets to field configuration doesn't work. You have to add them to the existing display modes in hook_install().

See entity_get_display and entity_get_form_display, which are deprecated, but contain examples how to add components to display modes and code replacing the deprecated functions to load the entity displays.