Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compiler generates fragment for single element when encountering self-closing tags #4030

Closed
jods4 opened this issue Jun 30, 2021 · 3 comments
Labels
has workaround A workaround has been found to avoid the problem 🐞 bug Something isn't working scope: compiler

Comments

@jods4
Copy link
Contributor

jods4 commented Jun 30, 2021

Version

3.1.2

Reproduction link

https://sfc.vuejs.org/#eyJBcHAudnVlIjoiPHRlbXBsYXRlPlxuICA8bWFpbj5cbiAgICA8cHJlIGNsYXNzPVwiY29kZVwiIC8+XG4gIDwvbWFpbj5cbjwvdGVtcGxhdGU+XG5cbjxzY3JpcHQgc2V0dXAgbGFuZz1cInRzXCI+XG48L3NjcmlwdD4ifQ==

Steps to reproduce

Look at the repro.
I found the culprit, it seem to happen when you use self-closing tags (e.g. <pre> in my example).

What is expected?

Generates a single root element template (main)

What is actually happening?

Generates a Fragment with whitespace and new lines before and after the <main> element.


This doesn't seem to happen in non-setup mode.

@LinusBorg LinusBorg changed the title script setup compiler generates fragment for single element Compiler generates fragment for single element when encountering self-closing tags Jun 30, 2021
@LinusBorg LinusBorg added 🐞 bug Something isn't working scope: compiler has workaround A workaround has been found to avoid the problem labels Jun 30, 2021
@jods4
Copy link
Contributor Author

jods4 commented Jun 30, 2021

My bad! 🤣
I made that supposition based on other components in my app before I identified what the culprit was...

This bug has annoying consequences, because there are things you can't do on a fragment component, such as using directives.

@LinusBorg
Copy link
Member

Sure. But if you use a closing tag, it'd working for now, so we have a workaround until it's fixed 😊

@github-actions github-actions bot locked and limited conversation to collaborators Oct 17, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
has workaround A workaround has been found to avoid the problem 🐞 bug Something isn't working scope: compiler
Projects
None yet
Development

No branches or pull requests

2 participants