feat(98_esmxport): add esm default export #2771
No reviewers
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
1 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: sheetjs/sheetjs#2771
Loading…
Reference in New Issue
No description provided.
Delete Branch "feature-addesmdefaultexport"
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?
Recently I upgraded the xlsx version of the project from 0.15.6=>0.18.5, which caused the project to report an error, and I found that the previous project used the following syntax
This upgrade causes the failure to feel still not very good, should you consider adding a default export?
Thanks for the answer
There's one upgrade caveat that needs to be noted: https://docs.sheetjs.com/docs/getting-started/installation/frameworks#xls-support
The CJS build includes the codepage dependency. This worked in the past when the library only shipped with the NodeJS and browser standalone builds. Webpack and other bundlers used the browser build without question.
ESM is a messy ecosystem. Thanks to incompatibilities between Node ESM / Browser ESM / Deno ESM / "Bundler" ESM, there was no universal way to import the codepage library from the main script.
The uniform solution is to invert the flow. The ESM builds do not import any dependencies by default, and you now must manually import the codepage tables for XLS support: