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

Production handles warnings differently from development #5867

Closed
daniesg opened this issue May 5, 2022 · 3 comments
Closed

Production handles warnings differently from development #5867

daniesg opened this issue May 5, 2022 · 3 comments

Comments

@daniesg
Copy link

daniesg commented May 5, 2022

Version

3.2.33

Reproduction link

sfc.vuejs.org/

Steps to reproduce

have a template with a list greater than 1, with length spelled incorrectly, that looks like:

<strong>{{tags[0]}}</strong>
<template v-if="tags.length > 1">
    <template v-for="index in (tags.legnth - 1)">
        , <strong>{{tags[index]}}</strong>
    </template>
</template>

What is expected?

Consistent warning/error handling between environments

What is actually happening?

Development shows no template error, test shows a warning, production hard errors.

Even the playground shows a warning on load, but still renders, would be nice for prod and development to do the same.


We recently had a bug that prevented the page from loading in production.

<template v-for="index in (tags.legnth - 1)">

Obvious failure since length was spelled wrong. What was weird though was that no error or warning showed up in development and the page loads fine. In test, I get

[Vue warn]: The v-for range expect an integer value but got NaN.

but the page still loads fine. And in production, a hard error, page doesn't load.
Some consistency would be nice, or at least a way to change the behaviour.

@yyx990803
Copy link
Member

yyx990803 commented May 6, 2022

This is the way all Vue warnings have always worked:

  • Warnings are shown during dev, and must be fixed before shipping to prod.
  • An unhandled warning during dev means it could lead to a hard error during prod.

@yyx990803 yyx990803 reopened this May 6, 2022
@yyx990803
Copy link
Member

For this specific case the error behavior is indeed inconsistent. It should also error in dev.

@daniesg
Copy link
Author

daniesg commented May 6, 2022

but I'm not getting a warning at all in dev. This bug was hard to figure out for us especially because I could only debug in prod without vue dev tools (disabled in prod). There was no warning in dev at all nvm, I see that this case is being fixed in the above commit. thanks!

iwusong pushed a commit to iwusong/core that referenced this issue May 13, 2022
@github-actions github-actions bot locked and limited conversation to collaborators Sep 28, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants