I want to learn the source code of v-if

hello, I want to learn the source code for v-if, but I can not find it, could you tell me which part it is in?

Itโ€™s not in one place, but is all happens in

The whole template-to-render-function is basically a two-step process:

  1. parse the template into an AST with an HTML parser
    1.1 enhance v-related stuff in that AST (e.g. the v-if directive)
  2. create render function from AST

The first part happens here, search that file for instances of processIf to see where Vue takes care of v-if

The second part, turning the AST nodes that have v-if directive into code with if-statements (or rather: ternary expressions),happens here

is there a way to perform the two steps in a custom directive?
ใ€Šel-tab-pane v-custom-directive>2ใ€Š/el-tab-pane>
what i really need is removing the node if a custom directive exists in it

I want to do this as well. Any help?

On top of what @LinusBorg mentioned, this might also be helpful to understand how AST of v-if looks like: https://ktsn.github.io/vue-ast-explorer/