I created a custom form and I use a js library on it. I attached my JS in my template file but in a first time, I tried to attach it directly on my form with
$form['#attached']['library'] = "mymodule/mylibrary"
like in D7 but it doesn't work.
I found none references to attach library directly to a form and no references to the "#attached" property so I suppose it has been remove.
My library works fine in the twig template file.
But in the case I don't used a custom template or I use various templates for various cases, can I attach my library directly to my form without pass by a hook function or must I pass necessary by the template file, a hook_preprocess or a hook_page_attachment?