Skip to content
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

undef error in <script setup> breaks HMR #5

Open
7 tasks done
abitwhy opened this issue Aug 28, 2022 · 7 comments
Open
7 tasks done

undef error in <script setup> breaks HMR #5

abitwhy opened this issue Aug 28, 2022 · 7 comments
Labels
bug Something isn't working feat: hmr

Comments

@abitwhy
Copy link

abitwhy commented Aug 28, 2022

Describe the bug

Any undef error in the <script setup> will break the HMR. If auto save file is on, then entering any incomplete code will cause an error and break the HMR.

Break means it no longer working, even if correct the code. And only fresh the page will make HMR work.
This happened only recently, and only happened in <script setup> .

Reproduction

https://vite.new/vue

Reproduce Steps

  1. Open a new Vite-Vue project (click the reproduction link above)
  2. Open src/App.vue
  3. Write an undef error in <script setup> (For example, write some characters in a new line)

System Info

N/A

Used Package Manager

npm

Logs

No response

Validations

@github-actions
Copy link

Hello @abitwhy. Please provide a minimal reproduction using a GitHub repository or StackBlitz. Issues marked with need reproduction will be closed if they have no activity within 3 days.

@sapphi-red
Copy link
Member

I tested with https://vite.new/vue but didn't happen.

Would you write the steps to reproduce?

@abitwhy
Copy link
Author

abitwhy commented Aug 29, 2022

@sapphi-red The reproduce steps were added in the top comment.

@sapphi-red
Copy link
Member

Please write more concrete steps.
I'm still not able to reproduce.
I edited HelloWorld.vue in the following steps.

  1.  <script setup>
     import { ref } from 'vue'
     
     defineProps({
       msg: String
     })
     
     const count = ref(0)
     </script>
  2.  <script setup>
     import { ref } from 'vue'
     
     defineProps({
       msg: String
     })
     
     const count = ref(0)
    
     console.log(
     </script>
  3.  <script setup>
     import { ref } from 'vue'
     
     defineProps({
       msg: String
     })
     
     const count = ref(0)
    
     console.log()
     </script>

@abitwhy
Copy link
Author

abitwhy commented Aug 29, 2022

Check this:

vite-HMR-bug-with-script-setup

@abitwhy
Copy link
Author

abitwhy commented Aug 29, 2022

After more testing, I found that only no-undef error will case this bug.

@sapphi-red
Copy link
Member

I was able to reproduce 👍

@abitwhy abitwhy changed the title Error in <script setup> will break HRM undef error in <script setup> breaks HMR Aug 29, 2022
@haoqunjiang haoqunjiang transferred this issue from vitejs/vite Dec 3, 2022
@haoqunjiang haoqunjiang added bug Something isn't working feat: hmr labels Dec 3, 2022
@edison1105 edison1105 added p3-minor-bug 🔨 An edge case that only affects very specific usage (priority) and removed p3-minor-bug 🔨 An edge case that only affects very specific usage (priority) labels Sep 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working feat: hmr
Projects
None yet
Development

No branches or pull requests

4 participants