-
-
Notifications
You must be signed in to change notification settings - Fork 8.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
<script setup> used alongside Options API can break ref in production mode #6242
Comments
This is kind of expected. It's strongly discouraged to mix In the docs we explain that a second script block should be used for:
However we can do better here:
|
/cc @skirtles-code What do you think about this in terms of docs, expected behavior and such? |
It's a pity, I hoped I could use
certainly doesn't suggest that it's strongly discouraged to do so. |
We probably can tighten this up a bit in the docs, but I also feel like there genuinely is a core bug here. The I agree that having some more compiler warnings would be a good idea for the options that can cause conflicts. Off the top of my head: Likewise for #6241. In my opinion that's a bug that should be fixed unless there's a good technical reason why it can't be made to work. I'm not suggesting that combining |
Good points, I was a bit too quick to judge here, thanks! Reopened #6241 accordingly. The generated code in that issue's playground even already uses the render proxy correctly to read In this issue here concerning the ref, we might be able to find a better way to handle it, I'll leave that to the folks who really know their way around our compiler internals. That being said, I also still think we should very heavily discourage this. It goes totally against the intented use of |
This what we expected. The different behavior between dev env and prod env makes us confusing. |
This is fixed by 2c27556 |
Vue version
3.2.37
Link to minimal reproduction
https://sfc.vuejs.org/#eNp9UNtOwzAM/ZXITyCtibQhIZUOjf/IS2k9Wlguip0Nqeq/k6wFuk2an+Jz8XE8wJv38hgRStC2YjT+UDO+aitSVb31kUXA/VYDYR2aToNQia3UQppaakLvWRBy9LO5cZZYnLqkOWIQW/G0fsnGSbq0zQb89i6waHFfxwOLYUJzGeTOtVQusVzTSg+PYhhX/8zve7yMgxX0JicUpvbyk5xNfz4P1DNBGv4iNKSj5F5Dx+ypVCpa//UhG2fULnEqRMu9waJ1ZreRa7l5Vm1PvMQlkinegzsRhpSoYd7sPFwlMB2mCGhbDBjuhl1pLwKvuJvQnDlqO8L4Awhro+k=
Steps to reproduce
No additional steps required.
What is expected?
Input to be displayed and no error.
What is actually happening?
ReferenceError: search is not defined
System Info
No response
Any additional comments?
The error occurs only when the
ref
is named like one of the component's variables/methods.The error occurs only in production mode.
There is no error if there is nothing in the <script setup> block.
The text was updated successfully, but these errors were encountered: