cjs compatibility

Open
#263 0 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
58/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale

Research direction

Start by inspecting the package.json exports map; the issue identifies the package entry points and the CJS failure as ERR_PACKAGE_PATH_NOT_EXPORTED. Verify the change with the repository's npm test script and confirm that a CommonJS consumer can load the package without that error.

Written by the indexing model from the issue text.

Description

Hi,

Using the library in a CJS module results in ERR_PACKAGE_PATH_NOT_EXPORTED due to the export definitions of the package?, the following diff fixes the issue.

diff --git a/node_modules/@massive.com/client-js/package.json b/node_modules/@massive.com/client-js/package.json
index 10bd9dd..de06876 100644
--- a/node_modules/@massive.com/client-js/package.json
+++ b/node_modules/@massive.com/client-js/package.json
@@ -6,8 +6,11 @@
   "types": "dist/main.d.ts",
   "type": "module",
   "exports": {
-    "types": "./dist/main.d.ts",
-    "import": "./dist/main.js"
+    ".": {
+      "types": "./dist/main.d.ts",
+      "default": "./dist/main.js",
+      "import": "./dist/main.js"
+    }
   },
   "scripts": {
     "test": "mocha",
Dominant language
TypeScript
Stars
273
Forks
74
Avg merge
7h 58m
Merged PRs (30d)
11

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from massive-com/client-js

All issues in massive-com/client-js

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.