sfc compile problem
Vue version
3.2.45
Link to minimal reproduction
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
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.
use <script src="index.js"><
+/script>
instead.
duplicate of https://github.com/vuejs/core/issues/7391