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

Use default keyword as the main #17

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ Here’s a complete `package.json` example, for a hypothetical module named `@mo
"version": "0.0.0",
"main": "./dist/index.js",
"exports": {
"": "./src/moment.mjs",
"default": "./src/moment.mjs",
"/": "./src/util/",
"/timezones/": "./data/timezones/",
"/timezones/utc": "./data/timezones/utc/index.mjs"
Expand All @@ -55,7 +55,7 @@ Here’s a complete `package.json` example, for a hypothetical module named `@mo

Within the `"exports"` object, the keys are concatenated on the end of the name field, e.g. `import utc from '@momentjs/moment/timezones/utc'` is formed from `'@momentjs/moment'` + `'/timezones/utc'`.

The main entrypoint is therefore the empty string, `"": "./src/moment.mjs"`. For modules that desire to export *only* a single entrypoint, e.g. `import request from 'request'`, the `"exports"` key itself can be set to the entrypoint:
The main entrypoint is the special keyword, `"default": "./src/moment.mjs"`. For modules that desire to export *only* a single entrypoint, e.g. `import request from 'request'`, the `"exports"` key itself can be set to the entrypoint:

```js
{
Expand Down