Error at first time dev by error: Unexpected "<"
when template has <script- component name or <script comment
#2942
Labels
p3-minor-bug
An edge case that only affects very specific usage (priority)
Describe the bug
There are two cases which can cause the same error:
Using a component name starts with
<script-
It happened to my project that i had a component named
ScriptDevelopPane
, so i use this componentHTML comment of
<script-
after i got an error from the template before, i tried to comment all my template but i found the error still existed. i decided to find out the exact line which is:
Then in both two situations, when i run a vitejs project by
vite
for the first time(which meansnode_modules/.vite
is not existed or empty):However, when i remove the component tag or even the whole js dependencies(e.g. change
src/index.ts
toaaa.ts
inindex.html
),vite
seems to be OK and successfully served inlocalhost:3000
. Even i added the<script-develop-pane />
component to template or change back tosrc/main.ts
later,vite
had nothing wrong resolving the new changes, the page is working too...i was stuck in this issue for about a whole week.After i knew the reason, i had checked the Vue Style Guide or W3C but i couldn't find that component name starts with
script
is forbidden. Maybe there is some other restrictions?btw, i tried the same case in Vue SFC playground and it seems good?
Reproduction
This can be reproduced in latest
@vitejs/app
template.https://github.com/ryancui-/vite-script-issue
Used package manager: npm | yarn
Before submitting the issue, please make sure you do the following
The text was updated successfully, but these errors were encountered: