Removing line breaks in Twig My twig file is adding line breaks in the HTML which results in white spaces, as shown in this picture:

In the browser inspector:

When I remove the line breaks in the inspector, the white spaces disappear.
The default code in the file views-view-field.html.twig is:
{{ output -}}

I have researched the problem quite a bit and tried the following already, without success:
{{ output|replace({&quot;\n&quot;:''}) }}
{{ output|trim }}
{% spaceless %}{{ output }}{% endspaceless %}
{% spaceless %}{{ output|render|trim }}{% endspaceless %}

I'm working on Drupal 8.7.6.
Any help would be appreciated.
The cause of the problem is probably not the template but how the field is configured in Views. You should be able to find a solution there, even if it means you need to rewrite the field output.
If you want to try solving it in this template you have to check what is inside of output. Views usually puts the field output in a markup object. Then you have to render it first before applying twig filters:
{{ output|render|striptags|trim }}

I've also added |striptags, otherwise you would see HTML tags in plain text on the screen because they are escaped by trim.