Webpack Bundling Trouble #3077
Labels
No Label
DBF
Dates
Defined Names
Features
Formula
HTML
Images
Infrastructure
Integration
International
ODS
Operations
Performance
PivotTables
Pro
Protection
Read Bug
SSF
SYLK
Style
Write Bug
good first issue
No Milestone
No Assignees
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: sheetjs/sheetjs#3077
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Hi there! I've been using this package to handle parsing XLSX files, so first off thank you for building this!
I am running into an issue regarding bundle size that I haven't been able to resolve. Was wondering if this was expected or if I need to adjust my approach. I am currently using this in a React/NextJS codebase, with Webpack as the bundler, and Bun as the package manager. The package itself takes up about 1mb in the client bundle, and each of the edge bundles being created, which is not ideal. XLSX is only being used when parsing files obviously.
Let's say I have some component like so:
and parse looks something like this:
No matter what I've tried, the XLSX is always present in the client bundle. I have tried initializing XLSX as such:
I've tried a util to import and export xlsx:
and use like so:
But no luck there either. Any suggestions? Thanks!
https://nextjs.org/docs/pages/building-your-application/optimizing/lazy-loading#with-external-libraries suggests you can
await import
from a relevant callback. We'll add a new NextJS example (the current one focuses on server-side processing).pages/index.tsx
with the following:In local testing, the route table looked like:
Checking the network tab, the library is not loaded initially:
After using the file input element, the library is loaded in a separate chunk:
Got it! It seems like that indeed worked, thank you!