fix(compiler): comment can cause vIf-related syntax errors
fix: keep comments in production and have a comment between v-if and v-else, encounter [vite:vue] v-else/v-else-if has no adjacent v-if or v-else-if. error
Why is test work?
Since the following code works in the test, the comments can be skipped. https://github.com/vuejs/core/blob/35dc2bbe7d22a4b551f912612f8d4f04788005a7/packages/compiler-core/src/transforms/vIf.ts#L132-L136
Steps to reproduce
- open the reproduction
- executed
npm run build - Error appears
Can you add some tests to it? Thanks
This test is the same as this issue, so I don't need to add the same cases for the test. https://github.com/vuejs/core/blob/35dc2bbe7d22a4b551f912612f8d4f04788005a7/packages/compiler-core/tests/transforms/vIf.spec.ts#L652-L664
Thanks for the PR. We still need a separate test case for this to better document the problem, and we should not introduce test-only logic to fix a case. See dd3354c4