core icon indicating copy to clipboard operation
core copied to clipboard

When using the defineOptions macro in the setup script, the static literal header comment in the code is incorrectly positioned

Open Banana-energy opened this issue 1 year ago • 2 comments

Vue version

3.5.11

Link to minimal reproduction

https://stackblitz.com/edit/vitejs-vite-z1m5xq?file=src%2FApp.vue

Steps to reproduce

  1. use the setup script in the code and utilizing the defineOptions macro.
  2. define a static literal and add a comment
  3. run the code

What is expected?

this is the result when the defineOptions macro is not used.

image

What is actually happening?

image

System Info

No response

Any additional comments?

No response

Banana-energy avatar Oct 05 '24 09:10 Banana-energy

Thank you for reporting this. Based on the details provided, it appears that this issue does not cause any functional problems or bugs in the code. It is primarily a matter of comment positioning, which does not affect the execution or behavior of the application.

edison1105 avatar Oct 06 '24 02:10 edison1105

Yes, this has almost no impact. However, I now want to perform some processing based on the code that has been handled by the compiler, similar to eslint-disable-next-line, which is causing some confusion.

Banana-energy avatar Oct 06 '24 03:10 Banana-energy

The code output of compiler-sfc is not meant to provide any guarantees about post-processing, if we commit to that it's going to lead to a whole category of additional issues.

Source-code processing should happen before the SFC is compiled by Vue.

yyx990803 avatar Oct 11 '24 03:10 yyx990803