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

fix(compiler-core): generate the correct tree if comment is between if/else #1262

Closed
wants to merge 1 commit into from

Conversation

pikax
Copy link
Member

@pikax pikax commented May 29, 2020

fix #1256

Different approach than #1260

This parses the template as in dev, but strips the Comment nodes at the end, this ensures the whiteline removal still runs.

EDIT:

<div id="app">
	<div />
	<!-- loading -->
	<div />

	Hello
</div>

ouputs:

import { createVNode as _createVNode, createTextVNode as _createTextVNode, openBlock as _openBlock, createBlock as _createBlock } from "vue"

export function render(_ctx, _cache) {
  return (_openBlock(), _createBlock("div", { id: "app" }, [
    _createVNode("div"),
    _createVNode("div"),
    _createTextVNode(" Hello ")
  ]))
}

@yyx990803
Copy link
Member

I did a similar fix in f3623e4 but should be more efficient to avoid double filtering calls.

@yyx990803 yyx990803 closed this Jun 11, 2020
@pikax pikax deleted the fix/v-else_comment_prod branch June 11, 2020 15:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

v-else fails on "prod" build when preceded by an HTML comment
2 participants