Skip to content

v-if will report an error in the vite production environment #10870

Closed
@ekkotest

Description

@ekkotest

Vue version

^3.4.26

Link to minimal reproduction

https://stackblitz.com/edit/vitejs-vite-dxqht5?file=src%2FApp.vue,src%2Fcomponents%2Ftest.svg,package.json,src%2Fmain.js&terminal=dev

Steps to reproduce

npm run preview , but in this demo i dont know how to show previw

What is expected?

no error: TypeError: Cannot read properties of null (reading 'insertBefore')
at insert (main-25115900.js:17:178)

What is actually happening?

TypeError: Cannot read properties of null (reading 'insertBefore')
at insert (main-25115900.js:17:178)
at C (main-25115900.js:13:38292)
at y (main-25115900.js:13:37900)
at N (main-25115900.js:13:44713)
at W (main-25115900.js:13:43277)
at E (main-25115900.js:13:39866)
at w (main-25115900.js:13:38654)
at y (main-25115900.js:13:38004)
at N (main-25115900.js:13:43762)
at W (main-25115900.js:13:43277)

System Info

System:
    OS: macOS 14.4.1
    CPU: (8) arm64 Apple M2
    Memory: 214.86 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 16.17.1 - ~/.nvm/versions/node/v16.17.1/bin/node
    Yarn: 1.22.21 - ~/.nvm/versions/node/v16.17.1/bin/yarn
    npm: 8.15.0 - ~/.nvm/versions/node/v16.17.1/bin/npm
    pnpm: 8.14.1 - ~/.nvm/versions/node/v16.17.1/bin/pnpm
  Browsers:
    Chrome: 124.0.6367.119
    Safari: 17.4.1
  npmPackages:
    vue: ^3.4.26 => 3.4.26

Any additional comments?

I want to switch the v-if state after one second

Metadata

Metadata

Assignees

No one assigned

    Labels

    🔨 p3-minor-bugPriority 3: this fixes a bug, but is an edge case that only affects very specific usage.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions