Skip to content
This repository has been archived by the owner on Jan 15, 2025. It is now read-only.

Direction for CJS / ESM support #125

Open
2 tasks
amoshydra opened this issue Dec 18, 2024 · 0 comments
Open
2 tasks

Direction for CJS / ESM support #125

amoshydra opened this issue Dec 18, 2024 · 0 comments

Comments

@amoshydra
Copy link
Contributor

amoshydra commented Dec 18, 2024

Hi good day!

Background

in the most recently PR #124, the build file is consolidated into a single js file using esbuild.

Issue 1

esbuild default configuration for bundling a web application. Therefore the output is usually expected to be loaded via a script tag, not via a module system.

Consequently this package at v22 will no longer be offered in CJS module and in ESM module format.

Issue 2

package.json's main, module, exports keywords are not updated to the actual build path.
image

Issue 3

Type declaration is no longer available

Impact

There is no issue with the latest published npm package as the existing files are not cleaned: see https://unpkg.com/browse/[email protected]/dist/

However, on a clean build, only 1 file will remain:
image

When that happen, this package will no longer be used with a module system (ESM / CommonJS)

Direction

I suspect this is not a desired outcome.

This issue wish to check what is the intended / desired build format for this package.

  • I should be available to contribute to the desired outcome too.

Possible outcome:

  • Combine all output file js into a single output (possible in both esbuild and rollup)
  • Continue to provide both CJS and ESM output (possible in rollup, may be slightly troublesome with esbuild, but can be explored)

Possible improvement

To delegate the building and publishing of the package via GitHub action - this can help ensure build is reproducible, preventing local build files from existing version to remain in published package

@amoshydra amoshydra changed the title Direction for CJS / MJS support Direction for CJS / ESM support Dec 18, 2024
amoshydra added a commit to amoshydra/decimal128 that referenced this issue Dec 19, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant