#3082·exceljs

Vite/Rollup build fails to resolve regenerator-runtime/runtime imported by exceljs.browser.js

Author: bpetiiCreated Sep 9, 2026Updated Sep 9, 2026

Description

Building a React application with Vite and pnpm fails because exceljs/lib/exceljs.browser.js imports regenerator-runtime/runtime, but that package cannot be resolved from ExcelJS.

Error

[vite]: Rollup failed to resolve import "regenerator-runtime/runtime"
from "node_modules/.pnpm/[email protected]/node_modules/exceljs/lib/exceljs.browser.js".

This is most likely unintended because it can break your application at runtime.

Environment

  • ExcelJS: 4.4.0
  • Vite: 8.0.16
  • Package manager: pnpm
  • Node.js: 22.19.17
  • Application: React

Steps to reproduce

  1. Install ExcelJS in a pnpm-managed Vite application:
bash
pnpm add [email protected]
  1. Import ExcelJS:
typescript
import ExcelJS from 'exceljs';

const workbook = new ExcelJS.Workbook();
  1. Run the production build:
bash
pnpm build
  1. Rollup fails to resolve:
regenerator-runtime/runtime

Actual behavior

The consuming application must explicitly install regenerator-runtime even though it is imported from ExcelJS code:

bash
pnpm add regenerator-runtime

Adding it as a direct dependency allows the build to complete.

Expected behavior

Installing and importing ExcelJS should provide all runtime dependencies required by its distributed browser entry. Consumers should not need to discover and explicitly install an undeclared transitive runtime dependency.

Additional context

This appears related to #1903, although that issue concerns Angular and @babel/runtime/regenerator. This case specifically involves:

exceljs/lib/exceljs.browser.js
→ regenerator-runtime/runtime
→ Vite/Rollup resolution failure with pnpm

pnpm’s strict dependency isolation may expose the issue where dependency-hoisting package managers do not.

Could regenerator-runtime be declared as a production dependency of ExcelJS, or could the browser entry be built without requiring this external runtime?