Skip to content

Production build error in codebases using jsondiffpatch package with Vite version above @4.0.2 #11986

@bpetii

Description

@bpetii

Describe the bug

I was trying to update Vite to the version of 4.1.1 in our company and I was facing an error saying:
Uncaught TypeError: Cannot read properties of undefined (reading 'close') from vendor.js file.

I knew it is coming from a node_modules deps, but I had no clue which package exactly and we got stuck. Finally I figured it out so I created a dummy project including that package: jsondiffpatch.

I downgraded vite to 4.1.1, 4.0.4, 4.0.3 - Failing
I downgraded vite to 4.0.2 and lower - Working

I feel there was a breaking change in releasing [email protected] and if I had to guess I would say it's the commonjs update.

Reproduction

https://github.com/bpetii/Vite-issue-reproduction

Steps to reproduce

  • Run yarn or npm install
  • Run server by yarn run server command
  • Type localhost:3000 in a browser
  • Open devtools and see the error in the console tab

System Info

System:
    OS: macOS 12.5.1
    CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
    Memory: 6.08 GB / 32.00 GB
    Shell: 5.8.1 - /bin/zsh
  Binaries:
    Node: 18.7.0 - /usr/local/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 8.15.0 - /usr/local/bin/npm
  Browsers:
    Chrome: 109.0.5414.119
    Safari: 15.6.1
  npmPackages:
    @vitejs/plugin-react: ^3.1.0 => 3.1.0 
    vite: ^4.1.0 => 4.1.1

Used Package Manager

yarn

Logs

No response

Validations

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug: upstreamBug in a dependency of Vite

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions