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

Add a CommonJS build to the package #63

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
dist
prettier.config.js
karma.config.js
dist-cjs
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
dist/
dist-cjs/
node_modules/
12 changes: 9 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,15 @@
"name": "@github/combobox-nav",
"description": "Attach combobox navigation behavior to an input.",
"version": "2.1.5",
"main": "dist/index.js",
"main": "dist-cjs/index.js",
"module": "dist/index.js",
"type": "module",
Copy link
Member

Choose a reason for hiding this comment

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

curios if we want to remove this, or if renaming dist-cjs/index.js to dist/cjs/index.cjs might b another option here.

Copy link
Member Author

Choose a reason for hiding this comment

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

Renaming might be an option, but I don't see a way to do that with tsc and I'd rather not introduce another tool. I saw that primer/react doesn't have this field so I figured it's probably okay to remove it.

"exports": {
".": {
"node": "./dist-cjs/index.js",
"require": "./dist-cjs/index.js",
"default": "./dist/index.js"
}
},
"types": "dist/index.d.ts",
"license": "MIT",
"repository": "github/combobox-nav",
Expand All @@ -16,7 +22,7 @@
"clean": "rm -rf dist",
"lint": "eslint .",
"prebuild": "npm run clean && npm run lint && mkdir dist",
"build": "tsc",
"build": "tsc && tsc --module commonjs --outDir dist-cjs",
"test": "karma start karma.config.cjs",
"pretest": "npm run build",
"prepublishOnly": "npm run build",
Expand Down