Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
anneprillo opened this issue Oct 29, 2024 · 1 comment

Comments

@anneprillo
Copy link

anneprillo commented Oct 29, 2024

🐛 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):

@anneprillo anneprillo changed the title [BUG] Works locally, but not on server [BUG] Works locally, but not on server - TypeError: g.Workbook is not a constructor Oct 29, 2024
@cstbnd
Copy link

cstbnd commented Nov 12, 2024

真的吗?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants