exceljs / exceljs/exceljs

[BUG] Works locally, but not on server - TypeError: g.Workbook is not a constructor

Open
#2,841 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
15.5k
Forks
2k
PR merge metrics
No merged PRs in 30d

Description

## 🐛 Bug Report

I have this working on my local machine, but it does not work on the dev server.
The excel file does not download, and I get this error:
`Uncaught TypeError: g.Workbook is not a constructor`

I have tried the solutions offered on ticket #960 with no success.

Lib version: 4.4.0

## Steps To Reproduce

I am using React + Typescript.

This is the import:
`export * as ExcelJS from 'exceljs';`

This is how I create the workbook:
```
const handleClick = () => {
const workbook = new ExcelJS.Workbook(); //Error occurs here

const sheet = workbook.addWorksheet(`Sheet 1`);
. . .
}
```

## The expected behaviour:

An `xlsx` file should download with a worksheet title "Sheet 1"

## Possible solution (optional, but very helpful):

```javascript

```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.