Subscribe on changes!

sfc compile problem

avatar
Mar 23rd 2023

Vue version

3.2.45

Link to minimal reproduction

https://sfc.vuejs.org/#eNpdUk2PmzAQ/SsjqxJESox6qxCJ1Eu19+2RQylMwBt/IHvYdIX47x3DOuxupEieGb/He88zi5/jKF8nFKWoQuvVSBCQpvFS26KAMKibkj3Sk+oHzX9Cn8/rCIAGNFhCZp3vsrW3HCQ3bT7st+F8gQRonQ0EpoMzmMbfOne3DzKAgYwugfyEx72XiErIW9fhEXRj+8NH0vjzrNjb/TZ6GW//dk/M+Q6cVyhLfOCW91NsfVIYlUSNnfRoO3Z8DXxqul9K4/ObbfNMcfufNF12hGyi6+lHdki8G4WbiBn+PL5VkSKNl+eYZ1VsxT7Uyt7YhD7XItCbxjAgUi1g8HhNPdmGUIsd9G2OMpMHJkmv51uGbAJfIqIqtkmCJlFs6u4V4VdXkZZ9sYPPuTjWoF2fZ52zmG12Y3Qf+LkgNKNuKLpjTcP3yzyDCZz7UhVcrV1lR47n9WT4YaJnnq/OOJiEFkehzOg8nUwzsg9neUH5yQHY2zpga2Vcgui9FrzBsa7FQDSGsijCtY1r/RKk833BJ+knS8qgxGBOf727B96SGFCk4BgXsfwHOuT9ww==

Steps to reproduce

I copied the sample code from the Shiki official website in vue and added comments to it. There were no issues when viewing it in VSCode, but when running the project, there was an error that did not clearly indicate that it was a problem with the comments. The error message pointed to syntax problems elsewhere. After being confused for a while, I discovered that the issue was with this commented section of code. However, SFC Playground immediately identified this as an issue with the comment code, whereas VSCode did not.

What is expected?

Want vscode can report error clearly

What is actually happening?

The error message pointed to syntax problems elsewhere.

System Info

System:
    OS: macOS 10.15.7
    CPU: (4) x64 Intel(R) Core(TM) i5-7360U CPU @ 2.30GHz
    Memory: 4.25 GB / 16.00 GB
    Shell: 5.7.1 - /bin/zsh
  Binaries:
    Node: 16.16.0 - ~/.nvm/versions/node/v16.16.0/bin/node
    Yarn: 1.22.15 - ~/.nvm/versions/node/v16.16.0/bin/yarn
    npm: 8.11.0 - ~/.nvm/versions/node/v16.16.0/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  Browsers:
    Chrome: 111.0.5563.64
    Edge: 111.0.1661.51
    Firefox: 109.0.1
    Safari: 15.6.1
  npmPackages:
    vue: ^3.2.45 => 3.2.47

Any additional comments?

No response

avatar
Mar 23rd 2023

Syntax highlighting issue + the SFC compiler should have a better error message.

avatar
Mar 23rd 2023

You cannot have </script> in your script block event inside comments. This is how HTML works and I believe Vue templates are parsed the same way.

avatar
Mar 23rd 2023

use <script src="index.js"><+/script> instead. duplicate of https://github.com/vuejs/core/issues/7391

avatar
Mar 23rd 2023

Let's track it in #7391