iamkun / iamkun/dayjs

Package doesn't define module entry points

Open
#2,562 0 comments 17 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
48.7k
Forks
2.5k
PR merge metrics
No merged PRs in 30d

Description

**Describe the bug**
The package.json does not define `exports` as module entry points for better ESM support, see also: https://nodejs.org/api/packages.html#package-entry-points

**Expected behavior**
The build process exports ES modules, but they are not properly exposed. This is particularly important when you want to service ESM in a browser.

The following addition to the `package.json` file should sove the issue:

```json
{
"exports": {
".": "./esm/index.js",
"./utils": "./esm/utils.js",
"./contant": "./esm/constant.js",
"./locale/*": "./esm/locale/*.js",
"./plugin/*": "./esm/plugin/*.js",
}
}
```

**Information**
- Day.js Version latest
- OS: any
- Browser any
- Time zone: 'Europe/Berlin'

Contributor guide

Open the contributing guide

Research direction

Start with package.json and inspect the build process outputs under esm/, especially index.js, utils.js, constant.js, locale files, and plugin files. Compare the package entry points with the Node.js package exports documentation and verify that the proposed subpaths resolve correctly for ESM consumers; done means the built modules are properly exposed without breaking existing package access.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js
Domain
api, build-system
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.