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

App crashing on production build when using react-export-excel #31

Closed
7 tasks done
aviyi opened this issue Aug 9, 2022 · 3 comments
Closed
7 tasks done

App crashing on production build when using react-export-excel #31

aviyi opened this issue Aug 9, 2022 · 3 comments

Comments

@aviyi
Copy link

aviyi commented Aug 9, 2022

Describe the bug

I'm try to move my react app to use vite instead of create-react-app
I'm using package call react-export-excel to export some data.
Everything work Ok on development mode .
When I'm try to build my app I'm getting an error "Uncaught Error: Could not dynamically require "./jszip". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.
"

Reproduction

https://github.com/aviyi/vite-xlsx

System Info

System:
    OS: Windows 10 10.0.19044
    CPU: (16) x64 11th Gen Intel(R) Core(TM) i7-11700K @ 3.60GHz
    Memory: 16.97 GB / 31.77 GB
  Binaries:
    Node: 16.15.0 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.22.19 - ~\AppData\Roaming\npm\yarn.CMD
    npm: 6.14.7 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Edge: Spartan (44.19041.1266.0), Chromium (104.0.1293.47)
    Internet Explorer: 11.0.19041.1566
  npmPackages:
    @vitejs/plugin-react: ^2.0.0 => 2.0.0
    vite: ^3.0.0 => 3.0.4

Used Package Manager

npm

Logs

No response

Validations

@bluwy
Copy link
Member

bluwy commented Aug 9, 2022

Looks like the core issue comes from this hacky code from js-xlsx. Can't seem to workaround it though from some light testing.

@patak-dev patak-dev transferred this issue from vitejs/vite Dec 3, 2022
@ArnaudBarre
Copy link
Member

ArnaudBarre commented Jan 22, 2023

Yeah I blown away that esbuild succeed to bundle this correctly in dev.

I think this is the kind of issue that would be a wontfix. I think we should not support every weird things people come up with webpack along the years.

Note: A solution for you would be to fork the lib and make it ESM friendly

@ArnaudBarre
Copy link
Member

From the beginning Vite plan was never to fully replace all of what webpack does, like supporting all this pre-ESM hacks.

Closing as won't fix.

@ArnaudBarre ArnaudBarre closed this as not planned Won't fix, can't repro, duplicate, stale Mar 26, 2023
@github-actions github-actions bot locked and limited conversation to collaborators Apr 10, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants