How to use the compile function from vue-template-compiler

Find comprehensive JavaScript vue-template-compiler.compile code examples handpicked from public code repositorys.

20
21
22
23
24
25
26
27
28
29
const vueParseObj = vueCompilerSfc.parse(source);
// console.log(util.inspect(vueParseObj.descriptor.template, false, null, true));
let jsAst = parser.parse(vueParseObj.descriptor.scriptSetup.content, {
  sourceType: "module",
});
let { ast: templateAst } = vueTemplateCompiler.compile(
  vueParseObj.descriptor.template.content
);
jsAst = initState(jsAst, store);
templateAst = initTemplate(templateAst, null, new Set());
fork icon0
star icon0
watch icon1

+ 19 other calls in file

6
7
8
9
10
11
12
13
14
15
let matched = code.match(/<script[\s\S]*?>([\s\S]+)<\/script>/d)
let script_offset = matched?.indices[1][0]
let script = matched?.[1]
if (!script || !template)
  return
const template_ast = compiler.compile(template, { outputSourceRange: true }).ast
console.log(template)
console.log(template_ast)

let variables = new Set()
fork icon0
star icon0
watch icon1

+ 19 other calls in file