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

(compiler-sfc): <script setup> - Import usage analyzer doesn't resolve dynamic arguments in non-inline mode #8537

Closed
mattersj opened this issue Jun 10, 2023 · 0 comments · Fixed by #8538
Labels
has PR A pull request has already been submitted to solve the issue 🔩 p2-edge-case

Comments

@mattersj
Copy link
Contributor

mattersj commented Jun 10, 2023

Vue version

3.3.4

Link to minimal reproduction

https://play.vuejs.org/#__DEV__eNqFUctuwjAQ/JWVe+BCbAluaahAfEAvvTU9hGSB0Pgh26GVUP69ayfQABW9RNqZ3ZnJ+MRWxvBjiyxlmSttbTw49K2BplC7Rc68y9lLrmpptPVwAotb6GBrtYQJnU1G1Bs6P43f183hssQFqlZy735X11qaCxuGEIDoTPQJyI8Gj9I0hUeaALJ48/Qe1Pl6XzfVR8QB4hBXotTdNmXhK6X9Hu35ZBivjjJx8WNTdg71TyuPArtGe1CFRFovY0YG4p4qhiw9eZ1iKI5C4HcsLgCxYDgFofjrsIBJ1J9MAzb8W0AH6YB3IeAgUmpFAudnWoyk0r+UCBwLPeeKkvUPmcjC8IPTihJGlXwgqJ201w0Y9RjmnO29Ny4VolXmc8dLLcWSOGFb5WuJSaXlcs5nfDYXVe38GOfoZLKx+suhJcecxYSDuCDwiDaxqCq0ocsHZje7V4Y33J1p8KQmO9b9AN3rF8I=

Steps to reproduce

Steps to reproduce the bug from scratch (repro already has this covered):

  1. Import an object/enum from another file.
  2. Try to use their keys as a source of dynamic attribute name or slot name in <script setup> component. Note that this enum/object is not supposed to be used anywhere else in the component except the mentioned place.
  3. Observe an error since our object/enum is not exposed to the template (you can also check the generated code and take a look at the final __returned__ variable).

What is expected?

This object/enum should be properly exposed to the template in the final __returned__ variable since it's already being used in the template.

What is actually happening?

An error like Cannot read properties of undefined (reading 'someProperty') because the variable we're trying to get access to is not exposed.

System Info

System:
    OS: macOS 12.4
    CPU: (10) arm64 Apple M1 Pro
    Memory: 87.78 MB / 16.00 GB
    Shell: 5.8.1 - /bin/zsh
  Binaries:
    Node: 18.12.1 - ~/.nvm/versions/node/v18.12.1/bin/node
    npm: 8.19.2 - ~/.nvm/versions/node/v18.12.1/bin/npm
  Browsers:
    Chrome: 114.0.5735.106
    Firefox: 113.0.2
    Safari: 15.5
  npmPackages:
    vue: ^3.3.4 => 3.3.4

Any additional comments?

This is a regression from v3.2.0-beta.4.

@sxzz sxzz added has PR A pull request has already been submitted to solve the issue 🔩 p2-edge-case labels Jun 11, 2023
@github-actions github-actions bot locked and limited conversation to collaborators Sep 7, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
has PR A pull request has already been submitted to solve the issue 🔩 p2-edge-case
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants