Skip to content
Open
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
17 changes: 15 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,20 @@
"publishConfig": {
"access": "public"
},
"main": "./index.js",
"types": "./index.d.ts",
Comment on lines +18 to +19
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These fields will be completely ignored once "exports" exists so they don't actually do anything.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are used by consumer projects with "moduleResolution": "node". We can keep both for better compatibility.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The author of https://cmdcolin.github.io/posts/2025-01-12-pureesm says

I specify main and exports. Exports is sufficient for some but requires consumers use moduleResolution with nodenext which is rare

So there might be value in keeping both

"exports": {
".": {
"types": "./index.d.ts",
"import": "./index.js",
"require": "./index.js"
Comment on lines +23 to +24
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can just put one line "default" here for now instead.

But this all conflicts with the PR for adding ESM support #104

Copy link
Author

@2wheeh 2wheeh Oct 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's true. I will resolve if any PR for ESM merged first.

For dual format support, we would need "import" and "require" both eventually.

},
"./*": {
"types": "./*.d.ts",
"import": "./*.js",
"require": "./*.js"
}
},
"files": [
"cosmos/",
"cosmos_proto/",
Expand All @@ -40,8 +54,7 @@
"prepare-publishing": "./scripts/prepare-publishing.sh",
"build": "rm -rf ./build && tsc && npm run prepare-publishing"
},
"dependencies": {
},
"dependencies": {},
"devDependencies": {
"@cosmology/telescope": "^1.12.20",
"@types/node": "^15.6.2",
Expand Down