Skip to content

Inconsistent behavior overriding standard object #539

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

Open
8 of 9 tasks
silane opened this issue Mar 5, 2025 · 1 comment
Open
8 of 9 tasks

Inconsistent behavior overriding standard object #539

silane opened this issue Mar 5, 2025 · 1 comment
Labels
p2-has-workaround 🍰 Bug, but has workaround (priority)

Comments

@silane
Copy link

silane commented Mar 5, 2025

Related plugins

Describe the bug

I am not exactly sure this is a bug of this plugin-in, sorry if this is not caused by this plugin-in.

Returning object of same name as standard object such as JSON or Date from setup function sometimes overrides standard object and sometimes not.

Although I cannot reproduce, I have an environment overriding always occur.

Reproduction

https://stackblitz.com/edit/vitejs-vite-4y7scdda?file=src%2Fcomponents%2FHelloWorld.vue

Steps to reproduce

  1. Open the reproduction URL
  2. Open src/components/HelloWorld.vue and look side by side with resulting page view. We see;
    • The first paragraph displays {{ JSON }}, and the JSON here is the object returned from setup function.
    • The second paragraph displays {{ JSON.toString() }}, and the JSON here is a standard object as can be seen from the resulting page shows [object JSON].

System Info

System:
    OS: Linux 5.0 undefined
    CPU: (8) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
    Memory: 0 Bytes / 0 Bytes
    Shell: 1.0 - /bin/jsh
  Binaries:
    Node: 18.20.3 - /usr/local/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 10.2.3 - /usr/local/bin/npm
    pnpm: 8.15.6 - /usr/local/bin/pnpm
  npmPackages:
    @vitejs/plugin-vue: ^5.2.1 => 5.2.1 
    vite: ^6.2.0 => 6.2.0

Used Package Manager

npm

Logs

No response

Validations

@edison1105 edison1105 added p3-minor-bug 🔨 An edge case that only affects very specific usage (priority) and removed pending triage labels Mar 12, 2025
@edison1105
Copy link
Member

It's an edge case. BTW, using JSON as a variable name is bad

@edison1105 edison1105 added p2-has-workaround 🍰 Bug, but has workaround (priority) and removed p3-minor-bug 🔨 An edge case that only affects very specific usage (priority) labels Mar 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
p2-has-workaround 🍰 Bug, but has workaround (priority)
Projects
None yet
Development

No branches or pull requests

2 participants