Subscribe on changes!

When using @vue/compiler-core to parse the .vue file, an error is reported "Illegal tag name. Use'&lt;' to print'<'."

avatar
Mar 12th 2021

Version

3.0.7

Reproduction link

https://codesandbox.io/s/vuecompiler-core-problem-fp4zl?file=/src/main.js

Steps to reproduce

  1. write a .vue file,must includes 「<」in script tag
  2. use 「@vue/compiler-core」's 「baseParse」parsing file content string

What is expected?

get correct result

What is actually happening?

report an error 「Illegal tag name. Use'<' to print'<'.」


@yyx990803 I am not sure is it because my usage is wrong,but without 「<」 it works Maybe need to convert again before baseParse?

avatar
Mar 12th 2021

you should be using @vue/compiler-sfc to compile Single File Components. Is there a specific reason you want to use the core compiler?

avatar
Mar 13th 2021

@LinusBorg Thank you for your response. I used it wrong. I try to use the parse function of @vue/compiler-sfc, it works👍 Thank you again~