Skip to content

[Vite 8][Regression] Cannot bundle the library @mescius/spread-* anymore #21975

@dubzzz

Description

@dubzzz

Describe the bug

In the context of a project I'm using the commercial library called @mescius/spread-*. When bumping the project from Vite 7 to Vite 8 I started to have consistent runtime crash on production bundles (works well with dev mode).

When opening a production bundle produced via Vite 8 against this library I got the following errors in the console:

Uncaught TypeError: can't access property "DR", e.Spread.Sheets.Designer is undefined

I initially though that the issue would be fixed by following the trick explained on https://vite.dev/guide/migration#consistent-commonjs-interop that I found on the issue #21841. But it was not enough.

Reproduction

https://stackblitz.com/edit/vitejs-vite-7nfa5syp?file=package.json

Steps to reproduce

Here is the Vite 7 version: vite-7.zip.

If you want to reproduce the issue:

  1. Bump Vite to ^8 in the package.json
  2. Run npm install
  3. Run a build using npm run build
  4. Preview the production bundle using npm run preview

Normally you'll not see the Excel-like display and will observe an error stack in the console.

WARNING
While I provided a stackblitz.com link, there is no possibility to run anything from @mescius/* except on localhost domain. Said differently it will not work from stackblitz.com whatever the version of Vite because the lib self-destroy itself when not running on localhost with proper API key.

System Info

System:
    OS: Windows 11 10.0.26100
    CPU: (12) arm64 Snapdragon(R) X Elite - X1E80100 - Qualcomm(R) Oryon(TM) CPU
    Memory: 32.13 GB / 63.49 GB
  Binaries:
    Node: 22.14.0 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.22.22 - C:\Users\Nicolas Dubien\AppData\Roaming\npm\yarn.CMD
    npm: 10.9.2 - C:\Program Files\nodejs\npm.CMD
    pnpm: 10.16.1 - C:\Users\Nicolas Dubien\AppData\Local\pnpm\pnpm.EXE
  Browsers:
    Chrome: 145.0.7632.160
    Edge: Chromium (141.0.3537.85)
    Firefox Developer Edition: 149.0 - C:\Program Files\Firefox Developer Edition\firefox.exe
  npmPackages:
    @vitejs/plugin-react: ^5 => 5.2.0
    vite: ^8 => 8.0.1

Used Package Manager

npm

Logs

Full build log: logs.log

Validations

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug: upstreamBug in a dependency of Vitep4-importantViolate documented behavior or significantly improves performance (priority)regressionThe issue only appears after a new release

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions