Skip to content

When the global variable and function definition parameter have the same name, the function parameter will be overwritten by the global variable. After troubleshooting, it is caused by the unplugin vue components plugin. Removing this plugin is normal #687

@WormGirl

Description

@WormGirl

Describe the bug

When the global variable and function definition parameter have the same name, the function parameter will be overwritten by the global variable. After troubleshooting, it is caused by the unplugin vue components plugin. Removing this plugin is normal

<script setup lang="ts">
const a = 3
function test(a: Number, b: Number) {
  // a的值应该是1才对  实际变成了3 有点离谱, 删掉unplugin-vue-components插件就正常了
  console.log(a, b)
}
</script>

<template>
  <button @click="test(1, 2)">
    点我可复现
  </button>
</template>

Reproduction

https://github.com/WormGirl/bug-report-unplugin-vue-components

System Info

System:
    OS: Windows 10 10.0.19043
    CPU: (16) x64 Intel(R) Core(TM) i7-10700 CPU @ 2.90GHz   
    Memory: 16.88 GB / 31.79 GB
  Binaries:
    Node: 16.20.1 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.22.17 - ~\AppData\Roaming\npm\yarn.CMD
    npm: 8.19.4 - C:\Program Files\nodejs\npm.CMD
    pnpm: 8.6.10 - ~\AppData\Local\pnpm\pnpm.CMD
  Browsers:
    Edge: Spartan (44.19041.1266.0), Chromium (116.0.1938.62)
    Internet Explorer: 11.0.19041.1566

Used Package Manager

pnpm

Validations

  • Follow our Code of Conduct
  • Read the Contributing Guide.
  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • Check that this is a concrete bug. For Q&A, please open a GitHub Discussion instead.
  • The provided reproduction is a minimal reproducible of the bug.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions