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

Vue2.insertAdjacentElement is not a function #10386

Closed
7 tasks done
kingyue737 opened this issue Oct 9, 2022 · 2 comments · Fixed by #10388
Closed
7 tasks done

Vue2.insertAdjacentElement is not a function #10386

kingyue737 opened this issue Oct 9, 2022 · 2 comments · Fixed by #10388
Labels
feat: ssr p3-downstream-blocker Blocking the downstream ecosystem to work properly (priority) regression The issue only appears after a new release

Comments

@kingyue737
Copy link
Contributor

Describe the bug

I imported a Vue 2 component library in vitest. The test should pass but it throws the following TypeError:

Vue2.insertAdjacentElement is not a function

I don't know whether it is a bug of vite, vitest or jsdom. Since there is no such issue when Vite <= 3.1.4, I post this bug here.

Reproduction

https://stackblitz.com/edit/vitest-dev-vitest-lhw5je

Steps to reproduce

Open the link and wait for the test to fail

System Info

System:
    OS: Linux 5.0 undefined
    CPU: (6) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
    Memory: 0 Bytes / 0 Bytes
    Shell: 1.0 - /bin/jsh
  Binaries:
    Node: 16.14.2 - /usr/local/bin/node
    Yarn: 1.22.10 - /usr/local/bin/yarn
    npm: 7.17.0 - /usr/local/bin/npm
  npmPackages:
    vite: ^3.1.6 => 3.1.6

Used Package Manager

pnpm

Logs

No response

Validations

@sapphi-red sapphi-red added p3-downstream-blocker Blocking the downstream ecosystem to work properly (priority) regression The issue only appears after a new release labels Oct 9, 2022
@sapphi-red
Copy link
Member

Changing the vue-echarts alias from vue-echarts/dist/index.esm.min.js to vue-echarts/dist/index.esm.js worked.
Also reverting #10300 (effb7c3) from v3.1 branch worked.

/cc @bluwy

@bluwy
Copy link
Member

bluwy commented Oct 9, 2022

Thanks for finding the cause sapphi. #10388 should fix this issue as var declarations was accidentally treated as block-scoped instead of function-scoped in #10300

@bluwy bluwy added the feat: ssr label Oct 9, 2022
@github-actions github-actions bot locked and limited conversation to collaborators Oct 24, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feat: ssr p3-downstream-blocker Blocking the downstream ecosystem to work properly (priority) regression The issue only appears after a new release
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants